Wrong CalendarValueHistory data return

 

Hello there, i'm facing an issue when trying to use CalendarValueHistory to get Economic Calendar data. When i get the information inside my EA i got this:



But pay attention to the right Economic Calendar Info right from https://www.mql5.com/en/economic-calendar/united-states:



My timezone is +3 from the Economic Calendar, so look at the 11:00 event (in my calendar it will be at 14:00), the problem here is that the impact_type which should be 2, it's 0. I really need this to be precise and correct to implement in an EA.


Can anybody help me?


Thanks!

Economic calendar and indicators of the United States
Economic calendar and indicators of the United States
  • www.mql5.com
Market Last Reference Previous Frequency GDP Last Reference Previous Frequency Labor Last Reference Previous Frequency Prices Last Reference Previous Frequency Money Last Reference Previous Frequency Trade Last Reference Previous Frequency Government Last Reference Previous Frequency...
 
You asked a coding question and you didn't provide any code. Nobody can help.
 
Alain Verleyen:
You asked a coding question and you didn't provide any code. Nobody can help.
Didn't provided any code because I'm using the default piece of code as seen here: https://www.mql5.com/en/docs/calendar/calendarvaluehistory

//--- country code for US (ISO 3166-1 Alpha-2)
   string US_code="US";
//--- get all US event values
   MqlCalendarValue values[];
//--- set the boundaries of the interval we take the events from
  datetime time = TimeCurrent();
   datetime date_from=time;  // take all events for today
   datetime date_to= time + 86400;                // 0 means all known events, including the ones that have not occurred yet 
//--- request US event history
   if(CalendarValueHistory(values,date_from,date_to,US_code))
     {
      PrintFormat("Received event values for country_code=%s: %d",
                  US_code,ArraySize(values));
      //--- decrease the size of the array for outputting to the Journal
//--- display event values in the Journal
      ArrayPrint(values);      
     }
   else
     {
      PrintFormat("Error! Failed to receive events for country_code=%s",US_code);
      PrintFormat("Error code: %d",GetLastError());
     }
//---

I don't think my code is the problem, it's more likely to be some problem related to the function CalendarValueHistory. Probably the returning data is not correct. And I don't know why is that.

Thank you anyway.
 
Vinicius Santiago Tenente:
Didn't provided any code because I'm using the default piece of code as seen here: https://www.mql5.com/en/docs/calendar/calendarvaluehistory

//--- country code for US (ISO 3166-1 Alpha-2)
   string US_code="US";
//--- get all US event values
   MqlCalendarValue values[];
//--- set the boundaries of the interval we take the events from
  datetime time = TimeCurrent();
   datetime date_from=time;  // take all events for today
   datetime date_to= time + 86400;                // 0 means all known events, including the ones that have not occurred yet 
//--- request US event history
   if(CalendarValueHistory(values,date_from,date_to,US_code))
     {
      PrintFormat("Received event values for country_code=%s: %d",
                  US_code,ArraySize(values));
      //--- decrease the size of the array for outputting to the Journal
//--- display event values in the Journal
      ArrayPrint(values);      
     }
   else
     {
      PrintFormat("Error! Failed to receive events for country_code=%s",US_code);
      PrintFormat("Error code: %d",GetLastError());
     }
//---

I don't think my code is the problem, it's more likely to be some problem related to the function CalendarValueHistory. Probably the returning data is not correct. And I don't know why is that.

Thank you anyway.

It seems that in build 2170 the problem with the function CalendarValueHistory has been solved.

 
Rasoul Mojtahedzadeh:

It seems that in build 2170 the problem with the function CalendarValueHistory has been solved.

Thanks for reply, how to get this version?


-----------Edit--------------


Just found that the build 2170 will be released today as seen here (https://www.mql5.com/en/forum/323540)


But the news about Economic Calendar only talks about the timezone fix:

16.MQL5: Fixed specification of time in economic calendar news. Now events are delivered by taking into account the time zone of the trade server to which the terminal is connected, instead of the local computer time zone.

This isn't my problem, my problem is the wrong returning data of some parameters that I don't think it's related to the timezone issue.

In my case, the impact_type is High (equals to 2) in economic calendar site, but when I get those data inside my code in platform it's always coming with wrong value, with value 0 almost all the times.

Any thoughts?

Thanks again.

Reason: