So I was thinking one of these, first create a session template that thinks the market closes at 15:45 and then opens up at 15:46. This will make for bad charts as when the market is really closed (at 17:00) there will be no data. But the market on close function should do the trick here.
Second, I thought I could set the exit on close seconds to reflect one hour and 15 minutes before 17:00. So 75 minutes * 60 seconds = 4,500 seconds before close to get all CL positions flat. This seems hack but I guess it would work.
Lastly I could write in a close function into the code:
if
(
EMA50 > EMA100
||
((ToTime(Time[0]) >= 154400 && ToTime(Time[0]) <= 180000)
&& Position.MarketPosition == MarketPosition.Short
)
{
Close position
}
Market on close is what I want to use if I can. Any thoughts?

Comment