Simple Coding Help - No Promise.

vijkris

Learner and Follower
thanks a lot
but it also ignore correct signals if comes in first bar ?
i used in amibroker only
but it still shows wrong buy signal at 9.15 start first bar
is there any other way plz??
check this out.

Code:
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );

SetPositionSize( 2000, spsShares ); // 2000 shares by default 
_SECTION_BEGIN("levels");

breakoutime = Param("open time",091500,091500,230000,1,0);// for nse 100000,
Filterdaych = ParamToggle("Filter day Change Connections", "No|Yes", 1) ;
dt = DateTime() ;
//mytimenum = DateTimeConvert(2,dt,TimeNum());
    //newt = mytimenum != 100000;

	dtnum = DateTimeConvert(2, dt,TimeNum()) ;
	newdt = dtnum != Ref(dtnum, -1);
    //mytimenum = DateTimeConvert(1,dt);
   // newt = mytimenum == 100000;

	Lastbar = H-H ;
	if (Filterdaych)
		Lastbar = dtnum != Ref(dtnum, 1) AND TimeNum()<=breakoutime; ;
strnday = "day";
afterbreakout0 = Cross(TimeNum(),breakoutime);
afterbreakout1 = TimeNum()>=breakoutime ;// TimeNum()>=100000;
NewDay = Day()!= Ref(Day(), -1);



DayH = TimeFrameGetPrice("H", inDaily, -1);		// yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1);		//				low
DayC = TimeFrameGetPrice("C", inDaily, -1);		//				close
DayO = TimeFrameGetPrice("O", inDaily,-1);			// current day open

if ( True )
{
R = DayH - DayL;      
S3 = DayC-(R * 1.1/4);
R4 = (R * 1.1/2)+DayC;
R3 = (R * 1.1/4)+DayC;
S4 = DayC- (R * 1.1/2);
}

Plot(IIf(lastbar,Null,R3), "r3",colorRed,styleStaircase);
Plot(IIf(lastbar,Null,R4), "r4",colorGreen,styleStaircase);
Plot(IIf(lastbar,Null,S3), "s3",colorPaleGreen,styleStaircase);
Plot(IIf(lastbar,Null,S4), "s4",colorOrange,styleStaircase);


//----
//Title = Name()
;
Filter=1;
AddColumn(C,"cmp",1.2);
AddColumn(R3,"R3",1.2);
AddColumn(R4,"R4",1.2);
AddColumn(S3,"S3",1.2);
AddColumn(S4,"S4",1.2);


_SECTION_END();

Buy1 = Cross (C, R4) AND L<r4;
Buy2 = Cross (C, S3) AND L<s3;
Sell1 = Cross (R3 ,C) AND H>r3;
Sell2 = Cross (S4 ,C) AND H>s4;

Buy= ( Buy1 OR Buy2);//AND TimeNum()>breakoutime;
Sell=  (sell1 OR sell2);// AND TimeNum()>breakoutime;



 PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-10);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-20);                      
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-15); 
 PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=10);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=20);                      
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-15);
 
hmm interesting top one will try now thansk a lot
can u come in any online chat sir??
is there no way in afl coding to say show buy signal only when price touches certain price target ???
that cross function gives this wrong signal at start first bar of day i think so
 
can u come in any online chat sir??
i think this will work for my problem
great thanks a lot
Buy1 = Cross (C, R4) AND L<r4;
Buy2 = Cross (C, S3) AND L<s3;
Sell1 = Cross (R3 ,C) AND H>r3;
Sell2 = Cross (S4 ,C) AND H>s4;
thats why needed other help bcoz everyone thinks in different view so will get new angle of simple solution
 
Last edited:

vijkris

Learner and Follower
hmm interesting top one will try now thansk a lot
can u come in any online chat sir??
is there no way in afl coding to say show buy signal only when price touches certain price target ???
that cross function gives this wrong signal at start first bar of day i think so
i think u r getting confused. the above afl arrows z only for entry. exit at price targets is not defined in this code. u have to exit at further resistance/support level. anyway I think the code is working properly now.
regards
 
my actual code is like this
Buy1 = (Cross (C, R4) OR Cross (H ,R4) OR Cross (R4 ,L)) AND L<R4;
Buy2 = (Cross (C, S3) OR Cross (S3 ,L) OR Cross (H ,S3)) AND L<S3;
Sell1 = (Cross (R3 ,C) OR Cross (H, R3) OR Cross (R3 ,L)) AND H>R3;
Sell2 = (Cross (S4 ,C) OR Cross (H, S4) OR Cross (S4 ,L)) AND H>S4;
anything wrong in this ??
to show buy signal when it touches price target itself i made like this
 

vijkris

Learner and Follower
ahhh i think that problem still not solved
its till shows wrong signal at firstbar of 5mins new day
now i am totally confused
pls post which scrip, and date, also photo. use imgur.com to upload proper screenshot.
 

vijkris

Learner and Follower
my actual code is like this
Buy1 = (Cross (C, R4) OR Cross (H ,R4) OR Cross (R4 ,L)) AND L<R4;
Buy2 = (Cross (C, S3) OR Cross (S3 ,L) OR Cross (H ,S3)) AND L<S3;
Sell1 = (Cross (R3 ,C) OR Cross (H, R3) OR Cross (R3 ,L)) AND H>R3;
Sell2 = (Cross (S4 ,C) OR Cross (H, S4) OR Cross (S4 ,L)) AND H>S4;
anything wrong in this ??
to show buy signal when it touches price target itself i made like this
pls post full code, so that I can check.
regards
 

Similar threads