I solved it by moving the EventSetTimer() call to OnCalculate() and retry every time OnCalculate() is called until successful.
All the time. Been broken for several years.
- Try to start the timer in OnCalculate/OnTick, as EventSetTimer sometimes fails on MT4, with ERR_INTERNAL_ERROR (4024), or ERR_CHART_NOREPLY (4030) and ERR_INVALID_FUNCTION_PARAMVALUE (4051) This is especially noticeable on terminal startup due to paging delays.
- Indicators generally shouldn't need it. MTF do when the initial HTF isn't yet downloaded/updated.
- I simply, use a singleton (gsTicker) and only enable it when necessary. See attached
Files:
common_utilities.mqh
24 kb
Thank you!

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
Hi,
I have an indicator on multiple open charts in MT4. The indicator fails sometimes on reinitialization after a symbol change, but only on the weekly chart for this symbol. This is very repeatable. The other timeframes/charts are fine. This happens always during OnInit() when EventSetTimer(1) is called. The error is an internal error (4024) and it happens again and again should I retry any number of times (tried up to 15). I am calling EventKillTimer() in OnDeinit().
Is this a known issue or is there any way to work around the problem?
Thanks