
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
Your code is very good to get accurate timer only if Ontimer() is called expectedly. What if Ontimer() is not called, especially when system is busy and for 24 hours test.
I don't know, I'm using EA and indicators based on fast timers (<1 second) and the refresh is as expected, never had a single problem.
I trusted that OnTimer is scheduled on time before I measure it. I also use 100 ms timer but it's not reliable neither.
The timer is reliable, but it won't run while it or OnTick is running.
How To Ask Questions The Smart Way. (2004)
Don't rush to claim that you have found a bug.
Questions Not To Ask
My program doesn't work. I think system facility X is broken.
It is almost always your code.
See my countdown timer (MT4)
Indicators: Zero Lag Timer - Indices - Articles, Library comments - MQL5 programming forum #8 (2017)
Your countdown codes are good and useful.
Since you calculate the remaining seconds each time when OnTimer() is called, you won't sense if OnTimer() is skipped for several seconds.
Your countdown codes are good and useful.
Since you calculate the remaining seconds each time when OnTimer() is called, you won't sense if OnTimer() is skipped for several seconds.
Thank you very much, Dominik. Obviously you are very experienced in dealing with accurate timer. I never know MT adjust the calls. In my codes, the OnTimer() is very simple, it should be deterministic in execution time.
I have a question, in my case each MT opened two charts. One chart runs a copy EA and the another is just a simple code measuring the timer dealy. From MQL documentation, each chart has independent thread. Two charts won't interact, right?
Is there any way to get a reliable timer?
I trusted that OnTimer is scheduled on time before I measure it. I also use 100 ms timer but it's not reliable neither.
Thank you very much, Dominik. Obviously you are very experienced in dealing with accurate timer. I never know MT adjust the calls. In my codes, the OnTimer() is very simple, it should be deterministic in execution time.
I have a question, in my case each MT opened two charts. One chart runs a copy EA and the another is just a simple code measuring the timer dealy. From MQL documentation, each chart has independent thread. Two charts won't interact, right?
Is there any way to get a reliable timer?
I have OnTimer in my EA with bunch of functions and the comment chart refreshing information with current time too.
That's good OnTimer() works well in your case. I'm not so lucky unfortunately.
Thanks again for your outline.
I am using different symbols in two charts.
I understand your idea and method. My real work within OnTimer() includes open trades and close trades. It may take no time in case of no trade or long time to make several orders. It's difficult to manage the execution time for such tasks inside OnTimer();
Anyway, your work is valuable.