Delay to get Calendar Data after publication -- Do you have Solution ? :)

 

Hi everyone, 

I'm on my first EA (with mql5) and I have some trouble. 

My goal: Get new datas from Calendar event after maximum 5sec. 

Unforthunetly I get new data sometimes after 1 minutes, sometimes 4 minutes.. It's too long ! 

I don't understand why, I use  EventTimer() to launch the trigger who check the change_id:


void OnTimer()
  {
  
   if(next_event[0].name != NULL){
      changeEventId();
   }
   else{
   }
  }
  

void changeEventId(){
   MqlCalendarValue values[];
   ulong change_id = next_event[0].change_id;
   if(CalendarValueLastByEvent(next_event[0].event_id, change_id , values) > 0){
         PrintFormat("%s: XXX  change detecte oldId: %d, newId: %d", __FUNCTION__, next_event[0].change_id, change_id);
         ArrayPrint(values);
   }
   else{
   }
}

 I hope you can a little bit help me, thank's ! 

Xasmy

Reason: