I am trying to squareoff my positions by the day end(intraday) using below piece of code.
_FirstTradeTime = 094500; // Earliest time to take a trade_
_LastTradeTime = 150000; // Latest time to take new trades_
_ExitAllPositionsTime = 152500; // Exit all trades_
_Buy = Buy AND (TimeNum() >= FirstTradeTime AND TimeNum() <= LastTradeTime);_
_Sell = Sell OR (TimeNum() >= ExitAllPositionsTime);_
But my positions are still carried forward till the next day during the backtest. Please help. Thanks in advance !!
@mn_sho: this question is completely unrelated to the one that you replied to. You should start a new thread. Before you do that, however, you should read @Tomasz's posts about how to use this site, do you own search on "bar replay", go through the basic troubleshooting steps (also detailed by @Tomasz), and then if you still can't figure out what's going wrong then post a question with a level of detail that allows others to provide specific help rather than trying to guess what you might be doing.
I was setting the Periodicity from the settings window. Actually I double checked my data, it seems that there were some bars missing in the data due to which square off condition was never getting hit.