I also get intermittent errors creating timers.
Cannot set timer (60) - EA not working - MT4 - MQL4 programming forum #1 (2019)
I also get intermittent errors creating timers.
Cannot set timer (60) - EA not working - MT4 - MQL4 programming forum #1 (2019)
I don't understand what you are trying to say duo to lack of explenation
1- it is a problem of MQL5 to MQL4
2- it is totally another problem I haven't get not set error !!!
3- Other related Questions in the forum that i search at least are not answered I can post links that I have read so don't comment me other posts please
No answer here as well:
https://www.mql5.com/en/forum/316556I just Wrote this solution I leave it here for others who has the same issue since I don't think this bug will be fixed anytime soon.
it is not perfect at least it is something
datetime startTime=0; int timerDelay = 4; // it is in seconds int OnInit(void) { ResetLastError(); if(!EventSetTimer(1)) { int e = GetLastError(); Print(_Symbol+"Cannot set Timer Error #", e); } startTime = TimeCurrent(); return(INIT_SUCCEEDED); } void OnTimer() { Print("On timer reached"); } int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { datetime dt = TimeCurrent(); if( (dt - startTime) > timerDelay) { startTime = dt; OnTimer(); } //--- return value of prev_calculated for next call return(rates_total); }

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I was developing an expert that should add an indicator to a fresh opened chart when some conditions are met
it is not a complex thing just an indicator
and this indicator is added with "ChartIndicatorAdd" function.
To elucidate:
1- indicator is working just fine when it is added to any chart manually
2- on time is set in the Oninit as reference said so
3- this problem is occurring only when indicator is added to a separate chart by an expert
4- There are no Errors when timer is set in the log
Another weird thing is that indicator's life cycle is not attached to the newly opened chart but to the expert!!!
I also realized that "IndicatorRelease" function is not working as well. after using this function Indicator is still generating data and it is working on the EA thread!! , So obviously there are major bug in this section of mql5!!!
please please avoid leaving not relevant answers thanks in advance. this site is turning to a pile of questions with not relevant answers I just get a headache when I am trying to find answers for my problems.