"cannot set timer" error

 

Hello fellow traders

Could somebody assist me in fixing this error for an EA I am Demoing?

Thanks in advance

 

@whroeder1

Thanks a lot! I am not a coder though just a newbie testing some EA's

 
EVANGFX:

@whroeder1

Thanks a lot! I am not a coder though just a newbie testing some EA's

Hey Guys, I tried the loop below on my OnInit() function, but after 100 attempts, it still doesn't want to set the timer... any idea ?

//--- create timer
   int error=-1;
   int counter=1;
   do
   {
      ResetLastError();
      EventSetTimer(delay);
      error=GetLastError();
      Print("EventSetTimer(delay);. Attempt=",counter," Error=",error);
      if(error!=0) Sleep(1000);
      counter++;
   }
   while(error!=0 && !IsStopped() && counter <= 100);
//---
 
Charly Oudy:

Hey Guys, I tried the loop below on my OnInit() function, but after 100 attempts, it still doesn't want to set the timer... any idea ?

Look at the Error value, MT5 will tell you why.