You asked a coding question and you didn't provide any code. Nobody can help.
string US_code="US";
//--- get all US event values
MqlCalendarValue values[];
//--- set the boundaries of the interval we take the events from
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());
}
//---
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
string US_code="US";
//--- get all US event values
MqlCalendarValue values[];
//--- set the boundaries of the interval we take the events from
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());
}
//---
It seems that in build 2170 the problem with the function CalendarValueHistory has been solved.
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.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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!