I set EventSetTimer() to 1 which means onTimer() functions is called at every 1 second. Now I am wondering what happens if onTimer() function takes more time than 1 second to execute ?
Timer go off, an event is added to the queue (assuming not one there already). New tick arrives, an event is added to the queue (assuming not one there already).
When existing code returns, the next item in the queue is processed.
Duplicate events are discarded. This is why you miss ticks.
JAVOKHIR SHOMURATOV:
I set EventSetTimer() to 1 which means onTimer() functions is called at every 1 second. Now I am wondering what happens if onTimer() function takes more time than 1 second to execute ?
I set EventSetTimer() to 1 which means onTimer() functions is called at every 1 second. Now I am wondering what happens if onTimer() function takes more time than 1 second to execute ?
I add this code to OnTimer() to confirm it is working
Comment("Server Time: ", TimeToStr(TimeCurrent(),TIME_SECONDS), "\nLocal Time: ", TimeToStr(TimeLocal(),TIME_SECONDS) );
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register