I moved all time-based logic to OnTimer, set with EventSetTimer(1) in OnInit:
- Session start and end flags, the daily reset, and the end of day flat rule all run in the timer.
- OnTick only handles price-based logic: signals, stops, trailing.
- The timer uses TimeTradeServer() and converts to UTC with a fixed offset table, because TimeCurrent() only updates with ticks.
One caution: the timer doesn't fire in the strategy tester the same way as live, so I test time logic separately in visual mode.
Do others split timer and tick logic like this, or keep everything in OnTick?