I'm currently using the following snippet of code:
if(ToTime(Time[0])>=235500)
{
ExitLong();
}
The strategy runs on Range bars, and COBC is true. I am using a similar bit of code (as above) to take the first entry of the day after some specific time. That works okay. Once entered, the strategy is always in the market and reverses only. The reversals occur using limit orders. There is no stop loss or profit target orders.
The problem is, the end of day exit (code above) is not effecting an exit. I think the problem has to do with operating on bar close, each bar is always less than 235500, until some bar closes after that; which is almost always some bar into the next day, say 000100; which of course is not >=235500.
Any way to work around this?

Comment