Skip first candle in opening range breakout

#1
I have ORB strategy which will mark high and low level at breakout time.
But I want to skip first 15 min candle from ORB calculation ..
How can write it in afl to skip first candle ?


_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", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
Plot( C, "Close", colorDefault, styleCandle );
NewDay = Day()!= Ref(Day(), -1);
EndDay = (Day()!= Ref(Day(), 1));
DayH = TimeFrameGetPrice("H", inDaily, -1); // yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1); // low
DayC = TimeFrameGetPrice("C", inDaily, -1); // close
DayO=ValueWhen(NewDay,O,1);//Todays Open
GPUP=DayO>DayH;
GPDN=DayO<DayL;
GPUP=ExRem(GPUP,EndDay);
GPDN=ExRem(GPDN,EndDay);
Ingpup=Flip(gpup,endday);
IngpDn=Flip(gpdn,endday);

BT = Param("BreakoutTime",94500,09000,120000);
target = Param("Target in Percentage",1,0.1,10,0.1);
HighValue=HighestSince(newDay,H);
LowValue=LowestSince(newDay,L);
RangeHigh = ValueWhen(Cross(TimeNum() , BT), HighValue);
RangeLow = ValueWhen(Cross(TimeNum() , BT), LowValue);
Buy = TimeNum() > BT AND TimeNum() < 150000 AND Cross(H,RangeHigh);
Short = TimeNum() > BT AND TimeNum() < 150000 AND Cross(RangeLow,L);
Buy= ExRem(Buy,newDay);
Short = ExRem(Short,newday);
Sell = Cross(H,RangeHigh*(1+target/100)) OR TimeNum()>151400 ;
Cover = Cross(RangeLow*(1-target/100),L) OR TimeNum()>151400 ;
Sell = ExRem(Sell,Buy);
Cover = ExRem(Cover,Short);

BuyPrice=ValueWhen(Buy,C);
ShortPrice=ValueWhen(Short,C);
CoverPrice=ValueWhen(Cover,C);
SellPrice=ValueWhen(Sell,C);

Long = Flip(Buy,Sell);
Shrt = Flip(Short,Cover);
SetPositionSize(100,spsShares);
Plot(RangeHigh*(1+target/100),"Long Target",colorBlue,styleLine| styleDots);
Plot(RangeLow*(1-target/100),"Short Target",colorBlue,styleLine| styleDots);
Plot(RangeHigh,"Range High",colorGreen,styleLine| styleDots);
Plot(RangeLow,"Range Low",colorRed,styleLine| styleDots);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorGreen, 0,Low,-10);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorRed, 0,High,-10);
PlotShapes(IIf(Cover, shapeUpTriangle, shapeNone),colorGreen, 0,High,-10);
PlotShapes(IIf(Sell, shapeUpTriangle, shapeNone),colorRed, 0,Low,-10);
dist = 1.5*ATR(10); for( i = 0; i < BarCount; i++ )
{
if( Buy ) PlotText( "Buy\n"+ " @" + C[ i ], i, L[ i ]-dist, colorGreen, colorYellow );
if( Short ) PlotText( "Short\n" + " @" + C[ i ], i, H[ i ]+dist, colorRed, colorYellow );
if( Cover ) PlotText( "Cover\n"+ " @" + C[ i ], i, L[ i ]-dist, colorGreen, colorYellow );
if( Sell ) PlotText( "Sell\n" + " @" + C[ i ], i, H[ i ]+dist, colorRed, colorYellow );

}
AddColumn(Buy,"Buy"); AddColumn(Sell,"sell"); AddColumn(Short,"short"); AddColumn(Cover,"cover");
 

Similar threads