Question on OnTick() event frequency/duration

 
Dear experts,

I have question on  OnTick() event .
Let's say OnTick() is triggered at every 1ms but the actions you perform inside OnTick() itself takes 5ms which is more than 1ms.
What happens in such cases ? Do actions accumulate or happen in parallel or next action skipped as previous one is still working ?

thank you
Robobiee
 
Robobiee: I have question on  OnTick() event . Let's say OnTick() is triggered at every 1ms but the actions you perform inside OnTick() itself takes 5ms which is more than 1ms. What happens in such cases ? Do actions accumulate or happen in parallel or next action skipped as previous one is still working ? 

Forum on trading, automated trading systems and testing trading strategies

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

Fernando Carreiro, 2023.04.23 11:03

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 #:
Great..thanx
Reason: