Hi,
It’s shitforbrains here again, sorry for the noob question. I’ve looked around but have not found any code that would allow me to run a system that opens a long or short position strictly based on the time of day. For example “go long or short at 09:00 and close trade at 13:00 if neither limit or stop is hit”. It would also help a lot if I could define which weekdays the system is allowed to take trades.
Any help?
Regards,
There you go:
TradeON = (DayOfWeek >= 0 AND DayOfWeek <= 5)
IF time = 090000 AND TradeON AND Not OnMarket THEN
BUY 1 CONTRACT AT MARKET
ENDIF
IF TIME = 130000 AND OnMarket THEN
SELL AT MARKET
ENDIF
For Short trades just replace BUY with SELLSHORT and SELL with EXITSHORT.