"cannot set timer(1)" problem in calling iCustom() function in EA

 

Hello Guys,

I have a problem for calling indicator values in my EA,

this message show on expert tab on MT4 when I attach it on chart: "cannot set timer(1)"

I search a lot in forum,some users say that Should use some codes in OnInit() and Deinit() sector of EA like this topic: "https://www.mql5.com/ru/forum/167394#comment_12192383"

but they didn't work at all,

please help me to solve problem,

Thanks for your feedback in advance.

Ошибка "cannot set millisecond timer(100)"
Ошибка "cannot set millisecond timer(100)"
  • 2017.01.19
  • www.mql5.com
Здравствуйте! У клиента при работе с моим советником возникла ошибка "cannot set millisecond timer(100...
 
what is your code line? show me
 
Mohammad Hasan Mosaddeqi:

I have a problem for calling indicator values in my EA,

this message show on expert tab on MT4 when I attach it on chart: "cannot set timer(1)"

I search a lot in forum,some users say that Should use some codes in OnInit() and Deinit() sector of EA like this topic: "https://www.mql5.com/ru/forum/167394#comment_12192383"

but they didn't work at all

This is expected behavior whenever an EA calls an indicator that uses EventSetTimer()/EventSetMillisecondTimer(), via iCustom().

 
Seng Joo Thio:

This is expected behavior whenever an EA calls an indicator that uses EventSetTimer()/EventSetMillisecondTimer(), via iCustom().

How can I solve it Sir?

I haven't source code of indicator.

 
Mohammad Hasan Mosaddeqi:

How can I solve it Sir?

I haven't source code of indicator.

You can always check whether your indicator still returns valid values - if it does, just ignore the "cannot set timer" message. Otherwise, you'll have to look for the source codes somewhere, somehow... or use other indicators :)

 
Seng Joo Thio:

You can always check whether your indicator still returns valid values - if it does, just ignore the "cannot set timer" message. Otherwise, you'll have to look for the source codes somewhere, somehow... or use other indicators :)

Dear,

my apologies for reopening this.

i have this issue with forexfactory news indicator and icustom.

when i set ea on chart, i get error cannot set timer.

i do have the mq4, but i have no clue what to do really.


this is the code for the settimer from the indicator:


int OnInit()
  {
//--- check for DLL
   if(!TerminalInfoInteger(TERMINAL_DLLS_ALLOWED))
     {
      Alert(INAME+": Please Allow DLL Imports!");
      return(INIT_FAILED);
     }
//--- indicator buffers mapping
   SetIndexBuffer(0,MinuteBuffer);
   SetIndexBuffer(1,ImpactBuffer);
   SetIndexStyle(0,DRAW_NONE);
   SetIndexStyle(1,DRAW_NONE);
//--- 0 value will not be displayed 
   SetIndexEmptyValue(0,0.0);
   SetIndexEmptyValue(1,0.0);
//--- 4/5 digit brokers                         
   if(Digits%2==1) Factor=10;
   else Factor=1;
//--- get today time
   TimeOfDay=(int)TimeLocal()%86400;
   Midnight=TimeLocal()-TimeOfDay;
//--- set xml file name ffcal_week_this (fixed name)
   xmlFileName=INAME+"-ffcal_week_this.xml";
//--- checks the existence of the file.
   if(!FileIsExist(xmlFileName))
     {
      xmlDownload();
      xmlRead();
     }
//--- else just read it 
   else xmlRead();
//--- get last modification time
   xmlModifed=(datetime)FileGetInteger(xmlFileName,FILE_MODIFY_DATE,false);
//--- check for updates
   if(AllowUpdates)
     {
      if(xmlModifed<TimeLocal()-(UpdateHour*3600))
        {
         Print(INAME+": xml file is out of date");
         xmlUpdate();
        }
      //--- set timer to update old xml file every x hours  
      else EventSetTimer( UpdateHour*3600);
 
     }
//--- set panel corner 
   switch(Corner)
     {
      case CORNER_LEFT_UPPER:  x0=5;   x1=165; x2=15;  xf=340; xp=390; anchor=0; break;
      case CORNER_RIGHT_UPPER: x0=455; x1=265; x2=440; xf=110; xp=60;  anchor=0; break;
      case CORNER_RIGHT_LOWER: x0=455; x1=265; x2=440; xf=110; xp=60;  anchor=2; break;
      case CORNER_LEFT_LOWER:  x0=5;   x1=165; x2=15;  xf=340; xp=390; anchor=2; break;
     }
//--- indicator name
   IndicatorShortName(INAME);
//---
   return(INIT_SUCCEEDED);
  }

i have tried putting in onCalculate, but i remain with same issue...

any solution, fix, explanation how to get this working without the error?


thanks

 
Geoffrey Lemaire: when i set ea on chart, i get error cannot set timer.

i do have the mq4, but i have no clue what to do really.

this is the code for the settimer from the indicator:

i have tried putting in onCalculate, but i remain with same issue...

  1. Your posted code has no set timer call.
  2. Set timer can (randomly) fail (4024/4030). If it fails in OnInit retry in OnCalculate/OnTick.
              Error: cannot set timer (1) - MQL5 programming forum #4 2020.02.24
 
William Roeder:
  1. Your posted code has no set timer call.
  2. Set timer can (randomly) fail (4024/4030). If it fails in OnInit retry in OnCalculate.
              Error: cannot set timer (1) - MQL5 programming forum #4 2020.02.24

Dear,


thanks for your quick reply

1. is this code below not a set timer call? 

      //--- set timer to update old xml file every x hours  
      else EventSetTimer( UpdateHour*3600);


2. i have checked your posts and reply's on the settimer posts already (google showed me diffirent results and i saw all your replys on all of these post) ... i have tried in oncalculate, and i remain with the same issue...

 

this is the result when i work with an loop



mt4 is freezing when i try to remove the ea.


i used this code below:


  //--- check for updates
   if(AllowUpdates)
     {
      if(xmlModifed<TimeLocal()-(UpdateHour*3600))
        {
         Print(INAME+": xml file is out of date");
         xmlUpdate();
        }
      //--- set timer to update old xml file every x hours  
      else EventSetTimer( UpdateHour*3600);
 
     }
         int error = - 1 ;
   int counter = 1 ;
   do
   {
      ResetLastError ();
      EventSetTimer (UpdateHour*3600);
      error = GetLastError ();
      Print (" EventSetTimer . Attempt =", counter, "Error =", error);
      if (error!= 0 ) Sleep ( 1000 );
      counter ++;
   }
   while (error!= 0 &&! IsStopped ());


i have no clue where to move on or what to do...


the point of the event is for updating the old xml file from forexfactory.

so the news calendar stays up to date.

i dont have issues with the indicator itself, only when i use icustom in the ea i get this error in the experts tab.


If anyone knows a solution, it is much welcome and appreciated.


thanks

 
Geoffrey Lemaire:

this is the result when i work with an loop



mt4 is freezing when i try to remove the ea.


i used this code below:



i have no clue where to move on or what to do...


the point of the event is for updating the old xml file from forexfactory.

so the news calendar stays up to date.

i dont have issues with the indicator itself, only when i use icustom in the ea i get this error in the experts tab.


If anyone knows a solution, it is much welcome and appreciated.


thanks

I have the same question,did you solved it ?
 
andyzhang0716:
I have the same question,did you solved it ?

When my EA calls the news indicator EA, an error message appears:cannot set timer(3600),but EA can open orders.

Reason: