How I can set the correct time to my indicator in MQL4 with the function EventSetTimer()?

 

Hello, I'm having problems with set time in MyFxBook indicator. I wrote this:


int OnInit()

  {

  

   

   //-------------------------------------------------------------------+

  

     int count=0;

   bool timerset=false;      

   while(!timerset && count<5)

     {

      timerset=EventSetTimer(1);

      if(!timerset)

        {

         printf("Cannot set timer, error %s. Set trying %d...",(string)_LastError,count);

         EventKillTimer();

         Sleep(200);

         timerset=EventSetTimer(1);

         count++;

        }   

     }

   if(!timerset)

     {

      Alert("Cannot set timer");

      return INIT_FAILED;

     }

   else

     {

      printf("%s success on setting timer.",Symbol());

     }

//---

      for( int i=10000; i>0; i--)

   {  

      double lotGreen = iCustom(NULL,0,"Myfxbook Outlook Indicator.ex4","kpPc0bcO7oZPiNWUwibt2477099"," ","EURUSD",0,3,14,80,

      clrBlack,clrCrimson,clrLimeGreen," ",false,1,i);

 

      Print("Valor del indicador = ",lotGreen, "\n", "Valor de i = ",i);


Anyone knows how I can get the correct indicator time? I want that the indicator give me the values second by second and not in milliseconds.

 
  1. MarioMiranda:

          double lotGreen = iCustom(NULL,0,"Myfxbook Outlook Indicator.ex4","kpPc0bcO7oZPiNWUwibt2477099"," ","EURUSD",0,3,14,80,
                                    clrBlack,clrCrimson,clrLimeGreen," ",false,1,i);

    Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
              General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
    Next time, post in the correct place. The moderators will likely move this thread there soon.

  2. MarioMiranda: Anyone knows how I can get the correct indicator time? I want that the indicator give me the values second by second and not in milliseconds.

    Post the indicator code if you want help. It is not giving values in milliseconds. iCustom is giving what is in the buffers.

Reason: