Download MetaTrader 5

Question on OnTimer

To add comments, please log in or register
Ingvar Engelbrecht
4506
Ingvar Engelbrecht  

When a timer expires the terminal "jumps" to "OnTimer" 

If the EA is working in some function 3 levels down (calling sub functions) how is that handled?

Is the code interrupted and then resumed att the correct place or has the timer to wait until the EA gets into an idle state?

Alain Verleyen
Moderator
32808
Alain Verleyen  
ingvar_e:

When a timer expires the terminal "jumps" to "OnTimer" 

If the EA is working in some function 3 levels down (calling sub functions) how is that handled?

Is the code interrupted and then resumed att the correct place or has the timer to wait until the EA gets into an idle state?

No the code is not interrupted, the timer event is placed on a queue.

EDIT: If the running code (function) originated from a previous timer event, then the new timer event WILL NOT be enqueued.

Documentation on MQL5: MQL5 programs / Program Running
Documentation on MQL5: MQL5 programs / Program Running
  • www.mql5.com
MQL5 programs / Program Running - Reference on algorithmic/automated trading language for MetaTrader 5
Ingvar Engelbrecht
4506
Ingvar Engelbrecht  
angevoyageur:

No the code is not interrupted, the timer event is placed on a queue.

EDIT: If the running code (function) originated from a previous timer event, then the new timer event WILL NOT be enqueued.

OK, thanks angevoyageur.
To add comments, please log in or register