Buy above or sell below on Nth candle.

madhavareddy1203

Well-Known Member
#1
Hi Guys,

Im intraday trader. I want buy/sell above /below8 th candle. ( whatever time frame)

I want to display prices of high or low of 8th candle entire day in my afl in signal box. Only 8 th candle prices.

And Buy signal should come when price cross 8th candle high. Sell signal should come when cross 8th candle below.

And need to draw lines from high of that high candle ( green) and low of that candle.. (red) like support and resitance lines.......

Plz anyone write code here.

or plz give advice to how to catch prices of 8th candle.


Thanks in advance..

Plz help mee..


thanks again and again
 

boarders

Well-Known Member
#6
x=BarsSince(Day()!=Ref(Day(),-1))+1;
y=ValueWhen(x==8,H);
z=ValueWhen(x==8,L);
Buy=Cross(H,y);
Short=Cross(z,L);


PlotOHLC ( O, H, L, C, "", IIf(C>O,colorBrightGreen,colorRed), styleCandle);
Plot( y, "", colorRed, styleLine | styleThick );
Plot( z, "", colorGreen, styleLine | styleThick );
il=L-0.05;
ih=H+0.05;

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorBlue, 0, iL, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorBlue, 0,iL, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorLightBlue, 0,iL, Offset=-45);
PlotShapes(IIf(Short , shapeSquare, shapeNone),colorRed, 0, iH, Offset=40);
PlotShapes(IIf(Short , shapeSquare, shapeNone),colorRed, 0,iH, Offset=50);
PlotShapes(IIf(Short , shapeDownArrow, shapeNone),colorDarkRed, 0,iH, Offset=-45);
 

madhavareddy1203

Well-Known Member
#7
1000000000000000000000000 thanks
thanks Boarders.. u rocked:thumb:

its working fine..

thanks to all..

:clapping::clapping:

x=BarsSince(Day()!=Ref(Day(),-1))+1;
y=ValueWhen(x==8,H);
z=ValueWhen(x==8,L);
Buy=Cross(H,y);
Short=Cross(z,L);


PlotOHLC ( O, H, L, C, "", IIf(C>O,colorBrightGreen,colorRed), styleCandle);
Plot( y, "", colorRed, styleLine | styleThick );
Plot( z, "", colorGreen, styleLine | styleThick );
il=L-0.05;
ih=H+0.05;

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorBlue, 0, iL, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorBlue, 0,iL, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorLightBlue, 0,iL, Offset=-45);
PlotShapes(IIf(Short , shapeSquare, shapeNone),colorRed, 0, iH, Offset=40);
PlotShapes(IIf(Short , shapeSquare, shapeNone),colorRed, 0,iH, Offset=50);
PlotShapes(IIf(Short , shapeDownArrow, shapeNone),colorDarkRed, 0,iH, Offset=-45);
 

boarders

Well-Known Member
#9
x=BarsSince(Day()!=Ref(Day(),-1))+1;
y=ValueWhen(x==8,H);
z=ValueWhen(x==8,L);
Buy=x>8 AND Cross(H,y);
Short=x>8 AND Cross(z,L);


PlotOHLC ( O, H, L, C, "", IIf(C>O,colorBrightGreen,colorRed), styleCandle);
Plot( y, "", colorRed, styleLine | styleThick );
Plot( z, "", colorGreen, styleLine | styleThick );
il=L-0.05;
ih=H+0.05;

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorBlue, 0, iL, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorBlue, 0,iL, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorLightBlue, 0,iL, Offset=-45);
PlotShapes(IIf(Short , shapeSquare, shapeNone),colorRed, 0, iH, Offset=40);
PlotShapes(IIf(Short , shapeSquare, shapeNone),colorRed, 0,iH, Offset=50);
PlotShapes(IIf(Short , shapeDownArrow, shapeNone),colorDarkRed, 0,iH, Offset=-45);
 
#10
Working g8..

Exactly i need this...

thanks once again.......... :clapping::clapping::clapping:
x=BarsSince(Day()!=Ref(Day(),-1))+1;
y=ValueWhen(x==8,H);
z=ValueWhen(x==8,L);
Buy=x>8 AND Cross(H,y);
Short=x>8 AND Cross(z,L);


PlotOHLC ( O, H, L, C, "", IIf(C>O,colorBrightGreen,colorRed), styleCandle);
Plot( y, "", colorRed, styleLine | styleThick );
Plot( z, "", colorGreen, styleLine | styleThick );
il=L-0.05;
ih=H+0.05;

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorBlue, 0, iL, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorBlue, 0,iL, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorLightBlue, 0,iL, Offset=-45);
PlotShapes(IIf(Short , shapeSquare, shapeNone),colorRed, 0, iH, Offset=40);
PlotShapes(IIf(Short , shapeSquare, shapeNone),colorRed, 0,iH, Offset=50);
PlotShapes(IIf(Short , shapeDownArrow, shapeNone),colorDarkRed, 0,iH, Offset=-45);
 

Similar threads