OnTimer() doesn't seem to run as expected
The answer is simple, but your previous rudeness put you on my do not help list. Live in ignorance.
Oh yes. Because you are a PARAGON of good manners.
https://www.mql5.com/en/forum/262079
You know how to respect forum members like nobody else.
https://www.mql5.com/en/forum/155887
<Deleted>
- 2018.07.01
- www.mql5.com
Please use ChartRedraw() after creating or modifying objects.
That doesn't work.
I've added ChartRedraw() to the end of every function in the code above except Init, and it doesn't make any difference. The problem persists.
In that case slower your timer interval.
If you want something like a clock create the object once and modify the time with ObjectSetString().
Seconds is updated by new ticks. Use TimeSeconds with gmt or local time.
Ah, yes! That was the problem. It works as expected now.
Many thanks!
My code is supposed to display a clock on the chart. In this case, I am displaying seconds only.
The problem is that I set the loop to run every 40 milliseconds with EventSetMillisecondTimer(40). Considering that 40 milliseconds happens 25 times at every second, the display update should never skip a second. But when the market is slow and not many ticks are coming through, many seconds are skipped, as if the code was running on OnTick() rather than on OnTimer().
What am I missing?
Here is the full code:
TIA