I have had an issue with my time exit during the last week. Can this have something to do with the change from summer to winter time?
I had one time exit set by:
DefPARAM Flatafter = 180000
This one worked in backtest and on demo but not on my live account.
On a different strategy I had another one set by:
if time>220000 or (dayofweek=5 and time>210000) then
exitshort at market
sell at market
endif
What is strange with the second one is that in the back test the time exit is working correctly all until yesterday’s position which is still open. (see screen shot)
I do use the MFE trailing stop (https://www.prorealcode.com/blog/learning/trailing-stop-max-favorable-excursion-mfe/) in combination to the time exit on these two strategies but it has not been a problem before.
When I run the backtest on the second strategy and change the time exit to 21:00 it stops where it should. Could this issue come from that the candle of 22:00-23:00 is missing and therefore it is no close to evaluate the code from? But in that case should the close not occur at the next closing candle since the time is after 22:00 or does it not happen then because the next candle is 00:00 which is smaller than 22?
Time is the time of when the candlestick is Closed. The exact time of when the code is read.
Thanks Nicolas! I understand that and I realised how that influenced my first error. However do you have an idea why I didn’t get an exit at 18:00 when I had flat after 180000 at the top of my system code?