Timer function in EAs and Indicators

 

Ok i have a question regarding the timer function, when a timer elapses the OnTimer function is called, suppose i have a timeout of 3seconds and the timer is triggered and my EA takes more than 3seconds to run, is the timer function going to trigger even if the other function is not yet finished, it it does trigger

what happens to the global and local variables that are already being used?

I have an interesting case where I am getting some "Access violation read/write to 0x...." on random location of the timer function please help.

 
tinashe:

Ok i have a question regarding the timer function, when a timer elapses the OnTimer function is called, suppose i have a timeout of 3seconds and the timer is triggered and my EA takes more than 3seconds to run, is the timer function going to trigger even if the other function is not yet finished, it it does trigger

what happens to the global and local variables that are already being used?

I have an interesting case where I am getting some "Access violation read/write to 0x...." on random location of the timer function please help.

  • If your EA takes more than 3 seconds to run, I suggest to revise your algorithm.

...If the Timer event is present in the queue or is being processed, the new Timer event will not be placed in the queue of the mql4 program.

  • It happens nothing to global/local variables, what do you mean ?
  • Please give us more information about you error message and code who produce it if you need help on this point.
 
tinashe:

Ok i have a question regarding the timer function, when a timer elapses the OnTimer function is called, suppose i have a timeout of 3seconds and the timer is triggered and my EA takes more than 3seconds to run, is the timer function going to trigger even if the other function is not yet finished, it it does trigger


I believe that OnTimer has uniform behaviour as OnTick or onCalculate, i.e. it does not create a queue nor triggers the function concurrently, but rather throws away the event.

Reason: