Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
I have been facing some issues on testing OnTimer but it does not happen always
only sometimes so hard to record the event, Timer stops and I also use time compare like if current bar timelocal is not syncing fast to last 2 bars time then alert ,so i may know when OnTimer function freezes and i can check error using GetLastError
but it never gives alerts just everything freezes and until the EA is restarted it does not work.
Do anyone has solution for this?
First guess would be an infinite loop somewhere . Second , a deletion of an object that does not exist , or , an editing of an object that does not exist.
I have always been "gating" ontimer execution but i dont know if that achieves anything .
Yes I use while loop to update bars on custom symbol
while(!IsStopped()) { MyFunction(); }
but I want to get notified if this loop stops, In MyFunction I already added conditions to nofify if bar stops updating but it all freezes
Comment((long)TimeGMT()," :Gmt, Bar Time: ", (long)result[0].time); if((long)TimeGMT() == (long)result[0].time-PeriodSeconds(PERIOD_M1) ) Alert("Network stopped ", GetLastError());
but alert never comes and bars are stopped updating
Yes I use while loop to update bars on custom symbol
but I want to get notified if this loop stops, In MyFunction I already added conditions to nofify if bar stops updating but it all freezes
but alert never comes and bars are stopped updating
Are you cycling through the "component" symbol's ticks in the loop ?
hold up you call this while loop on every timer ? do you kill the timer ?
I have never used IsStopped() why are you checking against it ?Are you cycling through the "component" symbol's ticks in the loop ?
Yes i am updating candle data and it works when there is while loop
hold up you call this while loop on every timer ? do you kill the timer ?
I have never used IsStopped() why are you checking against it ?I kill the timer on deinit
as on ducumentation i read, its advised
- www.mql5.com
Yes i am updating candle data and it works when there is while loop
I kill the timer on deinit
as on ducumentation i read, its advised
I think you can safely call MyFunction() without the while .
If i'm not mistaken , you are telling the terminal keep running this until you can't or something.
doesn't the data stay at the port until you pull it ? Its udp ?
I've had a local (same network) socket connection operate like that .
Call once in timer and check
- 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 have been facing some issues on testing OnTimer but it does not happen always
only sometimes so hard to record the event, Timer stops and I also use time compare like if current bar timelocal is not syncing fast to last 2 bars time then alert ,so i may know when OnTimer function freezes and i can check error using GetLastError
but it never gives alerts just everything freezes and until the EA is restarted it does not work.
Do anyone has solution for this?