EventSetTimer internal error (4024)

 

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

 
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.
  1. 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.
  2. Indicators generally shouldn't need it. MTF do when the initial HTF isn't yet downloaded/updated.
  3. I simply, use a singleton (gsTicker) and only enable it when necessary. See attached
Files:
 
Thank you!
Reason: