"Cannot set timer" ???? in ontime function

To add comments, please log in or register
Wonsuk Song
140
Wonsuk Song  

Hello,


I faced a strange error. I'm using ontime function based EAs and recently some EAs stopped with message "cannot set timer (xxx)". As you know, ontimer function requires 'EventSetTimer(xxx) to run the function repeatively.

Have you guys ever met this kinds of error?


Thank you for your feedback inadvance. :)

Fernando Carreiro
4986
Fernando Carreiro  
Wonsuk Song: I faced a strange error. I'm using ontime function based EAs and recently some EAs stopped with message "cannot set timer (xxx)". As you know, ontimer function requires 'EventSetTimer(xxx) to run the function repeatively.

Have you guys ever met this kinds of error?

No, you are not supposed to run EventSetTimer() repeatedly. You only set it once, for example in the OnInit(), or on the first OnTick(), and never again for the duration of the EA, disabling it in the OnDeinit() cycle.

The only other time you would need to call it again, is if you need to change the timer frequency.

EDIT: If you are using MT4, then also, please read the following thread as it might be related:

William Roeder
20250
William Roeder  
Wonsuk Song: Have you guys ever met this kinds of error?
In an indicator loaded by iCustom.
Wonsuk Song
140
Wonsuk Song  
Fernando Carreiro:

No, you are not supposed to run EventSetTimer() repeatedly. You only set it once, for example in the OnInit(), or on the first OnTick(), and never again for the duration of the EA, disabling it in the OnDeinit() cycle.

The only other time you would need to call it again, is if you need to change the timer frequency.

EDIT: If you are using MT4, then also, please read the following thread as it might be related:

Thanks. Funny thing is that other same EA works well, but some of EA stop sometimes. It is running repeatedly. I need to check other opinions. Thank you for your link!
EAML
24
EAML  

I can confirm this is still a mysterious problem even at the latest v4 build 1220.

We run an EA on multi-pairs both VPS hosted and PC.
This never happens on the PC, but only on single CPU VPS hosts.

Now, I would like to speculate that the issue may be related to using FTP to push data to myfxbook every 5 seconds. Using a EventSetTimer(10) seem to be an even number of this.

Perhaps internally MT4 is using similar thread timer for FTP pushes as OnTimer()?

Also @William Roeder mentioned some kind of upper number of timers per MT4 instance, may be ~60.

Where did you get this from? Also, we only use ~28.

William Roeder
20250
William Roeder  
EAML: Where did you get this from? 

Testing with 30 charts and several timers

Fabio Cavalloni
4213
Fabio Cavalloni  

I seen that issue using heavy EA in slow PC/VPS.

Usually re-attaching the EA to the graph solve the issue, it can be annoying in case of multiple EA and platform to be run at startup and they need manual intervention to be re-attached.

andrew
435
andrew  
EAML:

I can confirm this is still a mysterious problem even at the latest v4 build 1220.

We run an EA on multi-pairs both VPS hosted and PC.
This never happens on the PC, but only on single CPU VPS hosts.

Now, I would like to speculate that the issue may be related to using FTP to push data to myfxbook every 5 seconds. Using a EventSetTimer(10) seem to be an even number of this.

Perhaps internally MT4 is using similar thread timer for FTP pushes as OnTimer()?

Also @William Roeder mentioned some kind of upper number of timers per MT4 instance, may be ~60.

Where did you get this from? Also, we only use ~28.

I used EventSetTimer in EAs a lot but sooner or later would get that same error. I've now given up and use variations of OnTick() for everything time related....
To add comments, please log in or register