I’m using a strategy on a 30 minute chart but I want to close all trades 30 minutes before the close (3:30pm ET). I have included these to lines:
IsExitOnSessionCloseStrategy = true;
ExitOnSessionCloseSeconds = 1800;
but when testing it seems to close orders at the close, 4PM. Will this work when going live and/or playback?
Thanks.
Fyi, NT Support does not participate in these forums.
I wish they did, because this is one of those excellent questions that having a definitive answer from support would help everyone.
Unfortunately, you need to open a support ticket to ask a support question.
Or you can try emailing them.
Either way, this community of forum readers suffers, because they won’t answer you here.
Stupid bastards.
When backtesting on historical data, ExitOnSessionClose typically processes at the end of the bar. This is because, if you’re using bar data instead of tick data, there is no price for X seconds before the close so they have to assume the bar close price (or perhaps session close price. I’m not quite sure the behavior if you’re trying to exit more than one bar from the end of the session.)
So essentially, you’ll only get the true early exit behavior in real time trading, or perhaps if you’re using tick data in your backtests.
This is one reason I don’t use this feature, because it’s not consistent for historical and real time when not using tick data historically. If you were only exiting one minute early, then it might be good enough.
I would not use this feature for a 30 minute early exit. You’d probably be better off using a bar size of 30m or less and simply triggering the exit in OnBarUpdate
once a certain time of day has passed. Or some other logic appropriate to your scenario like adding the bar size to the current bar time to see if it meets or exceeds the session close time. This would tell you if the current bar is the penultimate bar of the session. You could also use SessionIterator to get the end of session time. SessionIterator
will be accurate, but it can also slow down processing quite a bit.