How OnTime() works if previous onTime() cycle is not finalised?

 
Hi everyone, 
I want to use OnTime() with high frequency and give it a lot of operations, so I am not sure if all of them will be processed in a given timeframe.
Will next OnTime() break execution of my code or it will wait untill everything in the previous OnTime() is executed?
 
Dimon1000000: I want to use OnTime() with high frequency and give it a lot of operations, so I am not sure if all of them will be processed in a given timeframe. Will next OnTime() break execution of my code or it will wait untill everything in the previous OnTime() is executed?

In MetaTrader, EAs are single threaded, and each event, be it Tick, Timer or Chart, will be placed in a queue and processed one at a time. Only after returning from the current event handler will the next event in the queue be processed.

Delaying the return of an event handler will delay the whole queue of pending events. For this reason, event handler functions should be efficient and return as soon as possible.

EDIT: Duplicate events are not added to the queue. For example, if there is already a Tick event in the queue, or it is being processed, then that event is not added.

 
Fernando Carreiro #:

In MetaTrader, EAs are single threaded, and each event, be it Tick, Timer or Chart, will be placed in a queue and processed one at a time. Only after returning from the current event handler will the next event in the queue be processed.

Delaying the return of an event handler will delay the whole queue of pending events. For this reason, event handler functions should be efficient and return as soon as possible.


Many thanks Fernando!
 
Dimon1000000: I want to use OnTime() with high frequency and give it a lot of operations,

Why are you causing your own problems? If nothing has changed, there is nothing to do. Your “operations” should be in OnTick.