Could somebody please help me in my afl. I want to run conditions on the last day of the week (friday..or a day earlier if friday is a holiday or 2 days ealier if both Thursday and Friday are holidays) and then take the trade on Monday opening price.
My AFL includes a Position Scoring logic but please note I do not want to use rotational trading.
I am currently using this but it is not working
Tradeday = DayofWeek() == 5;
What code do I enter so that on no trade days there are no entries or exits?
TradingDay = IIf(DayOfWeek()==5,1,
IIf(DayOfWeek()==4 AND Ref(DayOfWeek(),1)!=5,1,
IIf(DayOfWeek()==3 AND Ref(DayOfWeek(),2)!=5 AND Ref(DayOfWeek(),1)!=4,1,
0))) ;
Note: This formula is forward looking, so be careful.
For backtesting I do it like this, but you would need a different solution for generating current signals (when you have no future data in your database):