condion yesteday high & low
sell condtion = if today high break yesterday high condition true
than candel again reverse yesterday high down side break it sell & sl was today high
buy condtion = if today bar low break yesterday low condition true
than candel again break yesterday low up side it buy & sl was today
For the above condition check the given AFL code of Day Low - High System you can change periods or number of days as oer yoru requirement
_SECTION_BEGIN("10 Day High Low System");
pds = Optimize("pds" ,10,2,25, 1);
CB = LLV(C,pds);
CS = HHV(C,pds);
mav = TEMA(C,50);
Plot(Ref(CB, -1),"Long setup",colorBrightGreen);
Plot(Ref(CS, -1),"Short setup",colorRed) ;
Plot(Ref(mav, -1),"MA", colorGold, styleThick) ;
Buy= C < Ref(CB,-1);
Buy = Ref(Buy,-1);
BuyPrice = O;
Sell = C > Ref(CS,-1);
Sell = Ref(Sell,-1) ;
SellPrice = O;
Buy = ExRem(Buy,Sell) ;
Sell = ExRem(Sell,Buy) ;
SetChartOptions( 0, chartShowDates) ;
GraphXSpace = 5;
Plot(C,"C",colorWhite, 64);
PlotShapes(IIf( Buy,shapeSmallUpTriangle, 0),colorWhite, layer = 0,
yposition = BuyPrice, offset = 0 );
PlotShapes(IIf( Sell,shapeDownArrow,0),colorYellow, layer = 0,
yposition = SellPrice, offset = 0 );
_SECTION_END();