Download MetaTrader 5

Cannot set milisecond timer?

To add comments, please log in or register
Arturo Lopez Perez
168295
Arturo Lopez Perez  

Hi Everyone!

I hope you are fine. I have a problem -just sometimes-. I am creating a timer handler like this...

EventSetMillisecondTimer(50);

And works fine. But some users experience this error: Cannot set milisecond timer(50) and the program fails.

Am I doing something wrong?

Thanks in advance

Christopher Fernandez Ledon
704
Christopher Fernandez Ledon  
Is there a minimum time allowed?  I remember reading somewhere about a minimum of 100...it may be for the sleep function, can't remember off hand.
Jack Thomas
1869
Jack Thomas  
Arturo Lopez Perez:

Hi Everyone!

I hope you are fine. I have a problem -just sometimes-. I am creating a timer handler like this...

EventSetMillisecondTimer(50);

And works fine. But some users experience this error: Cannot set milisecond timer(50) and the program fails.

Am I doing something wrong?

Thanks in advance


#property copyright "author name"
#property link      "localhost"
#property version   "1.00"
#property strict

int OnInit(){
EventSetMillisecondTimer(50);
return(INIT_SUCCEEDED);
}

void OnDeinit(const int reason){
EventKillTimer();
}

void OnTick(){
//code executes here when there is a tick
}

void OnTimer(){
//code here executes every 100ms or as available.
}


honest_knave
Moderator
2326
honest_knave  
Christopher Fernandez Ledon:
Is there a minimum time allowed?  I remember reading somewhere about a minimum of 100...it may be for the sleep function, can't remember off hand.

No, you can use EventSetMillisecondTimer(1) if you so wish.

Which builds is this happening with? 

Christopher Fernandez Ledon
704
Christopher Fernandez Ledon  
Cool...learning something new every day :)
Thanks honest_knave.
Yury Kirillov
3789
Yury Kirillov  

Use it: 

https://www.mql5.com/ru/forum/167394

Ошибка "cannot set millisecond timer(100)"
Ошибка "cannot set millisecond timer(100)"
  • www.mql5.com
Здравствуйте! У клиента при работе с моим советником возникла ошибка "cannot set millisecond timer(100...
Arturo Lopez Perez
168295
Arturo Lopez Perez  
Thanks everyone
To add comments, please log in or register