HELP Error Code AFL // Buy 5 session before end of month and Sell 3 sessión next month

#1
Dear friends,

I have a problem with this code.

Thanks for your help.

//Daily SISTEM // Buy 5º session before end of month // Sell 3º sessión next month

PosQty = 1;
SetOption("MaxOpenPositions", PosQty);
SetTradeDelays(0,0,0,0);

isEndOfMonth = TimeFrameExpand(1,inMonthly,expandPoint);
isEntryDay = Ref(isEndOfMonth,5);

Buy = isEntryDay
Sell=Barssince(buy)==3

//ApplyStop( stopTypeNBar, stopModeBars, 3 );

BuyPrice = Close;
SellPrice = Close;
 

Attachments