Warning 509, TimeFrameExpand missing, was: ORB error

Hi Guys,

New member here! So learning AFL and trying things. I coded simply things and played around with the backtester. So I have a fair idea. That being said, I copied the ORB strategy code from the internet and went through the code. While I understood how most of the ocde is working, there is one error that keeps popping up. Need some help to resolve it the right way. The error and code are shown below:

Thanks!

Warning 509. You must use TimeFrameExpand() to expand compressed arrays

function ParamOptimize( pname, defaultval, minv, maxv, step ) 
{ 
return Optimize( pname, 
Param( pname, defaultval, minv, maxv, step ), 
minv, maxv, step ); 
} 

//_SECTION_BEGIN("Augubhai's ORB System");  

//--Intraday time frame  
TimeFrameSet(in5Minute); //If reseting, check formula for TimeFrameInMinutes  
TimeFrameInMinutes = 5; 

//--Define all params  
EntryBufferPct = ParamOptimize("Entry Buffer %", 0, 0, 2, 0.1); 
SLPct = ParamOptimize("SL %", 1.4, 0.1, 10, 0.1); 
TargetPct = ParamOptimize("Target %", 0, 0, 20, 0.5); 
MaxTarget = 100; 
TargetPct = IIf(TargetPct == 0, MaxTarget, TargetPct);  
EntryTimeStart = ParamOptimize("Entry Time Start (Minutes)", 5, 5, 120, 5); 
EntryBarStart = floor(EntryTimeStart/TimeFrameInMinutes) - 1; 
EntryTimeEnd = ParamOptimize("Entry Time End (Minutes)", 25, 10, 180, 5); 
EntryBarEnd = floor(EntryTimeEnd/TimeFrameInMinutes) - 1; 
EntryBarEnd = IIf(EntryBarEnd < EntryBarStart, EntryBarStart, EntryBarEnd);   

//--Plot Price Candle Chart 
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", colorBlack, styleNoTitle | GetPriceStyle() );  

//--New Day & Time. End Day & Time . End Day & Time is null till  _SECTION_BEGIN("ORB");
SetChartOptions(0,chartShowArrows|chartShowDates);
F=Param("Filter for ORB",0,0,100,0.05);
T =Param("Target in Points ",1,0,100,0.05);
_N(Ta=ParamList(" Target Line ","SHOW|HIDE"));
_N(BL=ParamList(" Bre.Out Line ","SHOW|HIDE"));
BOTS =ParamTime("Bre.OutStartTime","09:15:00",0);
BOTE=ParamTime("Bre.OutEndTime","09:15:00",0);
TCT = ParamTime("Trade Close Time","15:15:00",0);
dec = (Param("Decimals",2,0,7,1)/10)+1;
SetChartBkColor(ParamColor("Outer panel",colorBlack)); 
SetChartBkGradientFill(ParamColor("Inner panel upper",colorBlack),ParamColor("Inner panel lower",colorBlack));
NewDay = Day()!= Ref(Day(), -1);
EndDay = (Day()!= Ref(Day(), 1));
Breakoutstart=TimeNum()>BOTS-100 AND TimeNum()<=BOTS;
BreakoutEnd=TimeNum()>BOTE-100 AND TimeNum()<=BOTE;
TradeCloseTime = TimeNum()>TCT-100 AND TimeNum()<=TCT;
ORBHigh = ValueWhen(TimeNum()<=BOTE,HighestSince(BreakoutStart,H));
ORBLow = ValueWhen(TimeNum()<=BOTE,LowestSince(Breakoutstart,L));
ABHIGH = ValueWhen(TimeNum()<=TCT ,HighestSince(BreakoutEnd,H));
ABLOW = ValueWhen(TimeNum()<=TCT,LowestSince(BreakoutEnd,L));
Range = ORBHigh-ORBLow;
BuyFirst= ORBHigh+F;
SellFirst=ORBLow-F;
Range1 = BuyFirst-SellFirst;
DayHigh = TimeFrameGetPrice("H",inDaily);
DayLow  = TimeFrameGetPrice("L", inDaily);
Buycond = H >BuyFirst;
Sellcond= L <SellFirst;
Buy =  Buycond AND TimeNum()>BOTE AND TimeNum()<TCT;
Short= Sellcond AND TimeNum()>BOTE AND TimeNum()<TCT;
Cover = Buy OR TimeNum()==TCT;
Sell = Short OR TimeNum()==TCT;
Buy = ExRem(Buy,Sell);
Sell= ExRem(Sell,Buy);
Short= ExRem(Short,Cover);
Cover=ExRem(Cover,Short);
Bp = BuyFirst;
Sp = SellFirst;
BuyTar1 = Bp+Range;
Selltar1=Sp-Range;

Buy = Buy;
Short = Short;
Sell = H>BuyTar1 OR Sell ;
Cover= L<SellTar1 OR Cover;

Buy = ExRem(Buy,Sell);
Sell= ExRem(Sell,Buy);
Short= ExRem(Short,Cover);
Cover=ExRem(Cover,Short);


PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-20);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-30);                      
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-25); 
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=20);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=30);                      
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-25);
//PlotShapes(IIf(Sell1, shapeSquare, shapeNone),colorGreen, 0, H, Offset=40);
//PlotShapes(IIf(Sell1, shapeSquare, shapeNone),colorLime, 0,H, Offset=50);                      
PlotShapes(IIf(Sell, shapeStar, shapeNone),colorWhite, 0,H, Offset=45);
//PlotShapes(IIf(Cover1, shapeSquare, shapeNone),colorRed, 0, L, Offset=-55);
//PlotShapes(IIf(Cover1, shapeSquare, shapeNone),colorOrange, 0,L, Offset=-65);                      
PlotShapes(IIf(Cover, shapeStar, shapeNone),colorWhite, 0,L, Offset=-60); 
TrendColor = IIf(TimeNum()<=BOTE,colorPaleBlue,IIf(TimeNum()>TCT,colorPaleBlue,IIf(C>BuyFirst,colorBrightGreen, IIf(C<SellFirst ,colorRed,IIf(H>=BuyFirst AND L<=SellFirst ,colorGold,colorWhite))))); 
SetBarFillColor(TrendColor);
Plot(C,"",TrendColor,styleCandle);
Plot(TradeCloseTime,"",colorWhite,styleHistogram|styleOwnScale);
if(Ta=="SHOW")
{
Plot(BuyTar1,"",colorLime,styleDashed);
Plot(SellTar1,"",colorRed,styleDashed);
}
else
{
}
if(BL=="SHOW")
{
Plot(BuyFirst,"",colorLime,styleThick);
Plot(SellFirst,"",colorRed,styleThick);
}
else
{
}

Please read the manual:
https://www.amibroker.com/guide/h_timeframe.html

and

https://www.amibroker.com/guide/errors/509.html

Also, Warning 509 is not an error, please read this to understand the difference between error and warning

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.