In IStrategy, When is onBar() is called in realtime? For example, in realtime, the first tick happens at 02:05:000, then when is the onBar() corresponding to the 60Minute bar ( from 01:00:000 to 01:59:999 ) called? Is it called at 02:00:000 after JForex detects the localtime or server time has passed 02:00:000 or it waits for the first tick of next hour which is five seconds later than 2 O'Clock sharp? If it is the second case, which is called first, onBar() or onTick()?
Hi, Method onBar() is called when a first tick of the next candle has arrived. If there isn't new ticks, then the onBar() is called after 1 second when the last tick came for the last candle.
Thank you for replying. If the first tick of the next candle arrives at 02:00:001, would onBar() ALWAYS be called before onTick() is called?
Support wrote:
Hi, Method onBar() is called when a first tick of the next candle has arrived. If there isn't new ticks, then the onBar() is called after 1 second when the last tick came for the last candle.
The order of candles and ticks on the one instrument is guaranteed. That means the bar that logically forms at 02:00:000 will come before the tick at 02.00.001. Between different instruments the order is not guaranteed and onBar with the bar on USD/JPY can be called after tick on EUR/USD that logically should be after that bar.