Economic calendar. Questions, discussions.

 

I want to understand how the MQL5 economic calendar works, but something is not moving very fast. I spent most of yesterday and the beginning of today, but I still don't understand why CalendarValueHistory does not return all events. Or maybe I confuse them, these events a bit...

Yesterday I was getting 4 events at xx:45 as written in the calendar. I'm writing the event hours as "xx" because the time received is not the same as the one in the table. But at least one could understand that this is due to difference between terminal time and terminal time or server time from where the data was received. But now I got only 3 events with :45 minutes and I can't understand why.

And question to developers: Why in the array first date 2019.07.25 00:00 and next rows are sorted in ascending order. See the resulting list.

2019.07.24 10:12:22.297 !00 (EURUSD,H1)        [id] [event_id]              [time]            [period] [revision]       [actual_value]         [prev_value] [revised_prev_value]     [forecast_value] [impact_type] [reserved]
2019.07.24 10:12:22.297 !00 (EURUSD,H1) [ 0]  96782   76020005 2019.07.25 00:00:00 1970.01.01 00:00:00          0 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808             0          0
2019.07.24 10:12:22.297 !00 (EURUSD,H1) [ 1]  96840   76030003 2019.07.24 11:00:00 2019.07.01 00:00:00          0 -9223372036854775808             88500000 -9223372036854775808             91600000             0          0
2019.07.24 10:12:22.297 !00 (EURUSD,H1) [ 2] 100501  484020006 2019.07.24 11:00:00 2019.07.01 00:00:00          0 -9223372036854775808                10000 -9223372036854775808               110000             0          0
2019.07.24 10:12:22.297 !00 (EURUSD,H1) [ 3] 100502  484020007 2019.07.24 11:00:00 2019.07.01 00:00:00          0 -9223372036854775808               160000 -9223372036854775808               130000             0          0
// Пропущено, удалено вручную.
2019.07.24 10:12:22.297 !00 (EURUSD,H1) [59]  93627  410010001 2019.07.25 21:00:00 2019.07.01 00:00:00          0 -9223372036854775808             97500000 -9223372036854775808             97000000             0          0
2019.07.24 10:12:22.297 !00 (EURUSD,H1) [60]  87322  392030006 2019.07.25 23:30:00 2019.07.01 00:00:00          0 -9223372036854775808               900000 -9223372036854775808               900000             0          0
2019.07.24 10:12:22.297 !00 (EURUSD,H1) [61]  87323  392030004 2019.07.25 23:30:00 2019.07.01 00:00:00          0 -9223372036854775808              1100000 -9223372036854775808              1100000             0          0
2019.07.24 10:12:22.297 !00 (EURUSD,H1) [62]  87324  392030005 2019.07.25 23:30:00 2019.07.01 00:00:00          0 -9223372036854775808               800000 -9223372036854775808               800000             0          0
 

Some questions have fallen away. The time was sorted out. It turned out to be simple. The time is GMT, and the site was represented by GMT+3, hence all my misunderstandings added up.

Here's the first result: Received event description, first line in the picture


2019.07.24 11:29:03.972 !00 (EURUSD,H1) время и дата события - 2019.07.24 13:45:00
2019.07.24 11:29:03.972 !00 (EURUSD,H1) идентификатор события - 840500001
2019.07.24 11:29:03.972 !00 (EURUSD,H1) тип события из перечисления ENUM_CALENDAR_EVENT_TYPE - CALENDAR_TYPE_INDICATOR
2019.07.24 11:29:03.972 !00 (EURUSD,H1) сектор, к которому относится событие - CALENDAR_SECTOR_BUSINESS
2019.07.24 11:29:03.972 !00 (EURUSD,H1) частота (периодичность) события - CALENDAR_FREQUENCY_MONTH
2019.07.24 11:29:03.972 !00 (EURUSD,H1) режим времени события - CALENDAR_TIMEMODE_DATETIME
2019.07.24 11:29:03.972 !00 (EURUSD,H1) идентификатор страны - 840
2019.07.24 11:29:03.972 !00 (EURUSD,H1) текстовое имя страны (в текущей кодировке терминала) - Соединенные Штаты
2019.07.24 11:29:03.972 !00 (EURUSD,H1) единица измерения значения экономического индикатора - CALENDAR_UNIT_NONE
2019.07.24 11:29:03.972 !00 (EURUSD,H1) важность события - CALENDAR_IMPORTANCE_MODERATE
2019.07.24 11:29:03.972 !00 (EURUSD,H1) множитель значения экономического индикатора - CALENDAR_MULTIPLIER_NONE
2019.07.24 11:29:03.972 !00 (EURUSD,H1) количество знаков после запятой - 1
2019.07.24 11:29:03.972 !00 (EURUSD,H1) URL источника, где публикуется событие - https://www.markiteconomics.com
2019.07.24 11:29:03.972 !00 (EURUSD,H1) код события - markit-manufacturing-pmi
2019.07.24 11:29:03.972 !00 (EURUSD,H1) текстовое имя события на языке терминала (в текущей кодировке терминала) - Индекс менеджеров по закупкам в производственном секторе от Markit
 

Question for the developers:

Why does this code from the documentation, with minor modifications

void OnStart()
{
   MqlCalendarValue values[]; 

//--- запросим историю событий от текущего времени до конца сегодняшнего дня.
   if(CalendarValueHistory(values,TimeCurrent(),iTime(_Symbol, PERIOD_D1, 0)+PeriodSeconds(PERIOD_D1))) 
     { 
      PrintFormat("Получены значения событий по country_code=%s: %d", ArraySize(values)); 
//--- выведем значения событий в Журнал 
      ArrayPrint(values);
      
     } 
   else 
     { 
      PrintFormat("Ошибка! Не удалось получить события по стране country_code=%s"); 
      PrintFormat("Код ошибки: %d",GetLastError()); 
     } 
//---
}

shows that the size of the values array is zero, but nevertheless prints out everything in the calendar. That is, all events are received.

2019.07.24 15:20:33.131 !00 (EURUSD,H1) Получены значения событий по country_code=(non-string passed): 0
2019.07.24 15:20:33.131 !00 (EURUSD,H1)      [id] [event_id]              [time]            [period] [revision]       [actual_value] [prev_value] [revised_prev_value]     [forecast_value] [impact_type] [reserved]
2019.07.24 15:20:33.131 !00 (EURUSD,H1) [0] 97265   76020013 2019.07.24 15:30:00 1970.01.01 00:00:00          0 -9223372036854775808     -1227000 -9223372036854775808             -2405000             0          0
2019.07.24 15:20:33.131 !00 (EURUSD,H1) [1] 87842  840220012 2019.07.24 17:00:00 1970.01.01 00:00:00          0 -9223372036854775808      1791000 -9223372036854775808 -9223372036854775808             0          0
2019.07.24 15:20:33.131 !00 (EURUSD,H1) [2] 93625  410010011 2019.07.24 23:00:00 2019.04.01 00:00:00          1 -9223372036854775808      -400000 -9223372036854775808               400000             0          0
2019.07.24 15:20:33.131 !00 (EURUSD,H1) [3] 93626  410010012 2019.07.24 23:00:00 2019.04.01 00:00:00          1 -9223372036854775808      1700000 -9223372036854775808              2900000             0          0
2019.07.24 15:20:33.131 !00 (EURUSD,H1) [4] 87394  392060016 2019.07.24 23:50:00 2019.06.01 00:00:00          0 -9223372036854775808       800000 -9223372036854775808                    0             0          0
2019.07.24 15:20:33.131 !00 (EURUSD,H1) [5] 97012  392070003 2019.07.24 23:50:00 2019.07.20 00:00:00          0 -9223372036854775808    950000000 -9223372036854775808 -9223372036854775808             0          0
2019.07.24 15:20:33.131 !00 (EURUSD,H1) [6] 97013  392070004 2019.07.24 23:50:00 2019.07.20 00:00:00          0 -9223372036854775808    -93100000 -9223372036854775808 -9223372036854775808             0          0

Where, what does not have time to work?

 
In the format line %s is superfluous
 
Renat Fatkhullin:
The format string %s is redundant

Yes, thank you. I've already sorted that out. I messed up when fixing the example from the documentation.

 

@Renat Fatkhullin Renat, can we hope that someday a function like TimeGMTOffset() will be made, only by server time and not by local time? Because the economic calendar functions use GMT time and the local time often doesn't coincide with the server time. So, when I get news time, I need to translate it to terminal time. I understand that there can be problems when calling this function at weekend, but it can detect some kind of error, that this function is not available at this time, or whatever.

So far I've made like this: in OnInit() timing difference is calculated and written into global variable. But I don't really like it. In my opinion it would be better to call built-in function and adjust news time to server time. Especially the terminal probably has server time available on weekends as well.

 
Alexey Viktorov:

@Renat Fatkhullin Renat, can we hope that someday a function like TimeGMTOffset() will be made, only by server time and not by local time? Because the economic calendar functions use GMT time and the local time often doesn't coincide with the server time. So, when I get news time, I need to translate it to terminal time. I understand that there can be problems when calling this function on weekends, but it is possible to determine some kind of error, that this function is not available at the moment or something else.

So far I did so: in OnInit() time difference is calculated and written in global variable. But I don't really like it. In my opinion it would be better to call built-in function and adjust news time to server time. Especially the terminal probably has server time available on weekends as well.

Of course it's available, this has already been requested.

 
Vitaly Muzichenko:

Of course it is available, this has already been requested.

Vitaly, any request needs to be justified. I hope I have provided enough arguments for the necessity of such a function. Now it depends on the workload of the company's programmers and how the arguments are understood and accepted. I hope so.

 

What information can be gleaned from the calendar: (Values that are used by the software and are of little information to humans are not listed here)

  • Name of country
  • Currency of countries
  • type of event

Event (rally, speech, etc.)

Indicator

Holiday


  • Sector to which the event belongs

Market, stock exchange

Gross domestic product (GDP)

Labour market

Prices

Money

Trade

Government

Business

Consumption

Housing

Taxes

Holidays


  • text name of the event in the language of the terminal (in the current encoding of the terminal)
  • time and date of event
  • reporting period of the event
  • current value of parameter
  • previous value of parameter
  • revised previous value of the indicator
  • forecasted value of an indicator
  • potential impact on currency rate

No impact indicated

Positive impact

Negative impact


Unfortunately, except for the prohibition of opening positions before news releases I haven't found any other solutions. I want to find out which of them can be used and how to react to them.

As I understand it, the highlighted values are very important in deciding how to react to the news but I do not understand how. I invite discussion.

 
Alexey Viktorov:

What information can be obtained from the calendar: (Values that are used by the program and are of little information to humans are not listed here)

  • Name of country
  • Currency of countries
  • type of event

Event (rally, speech, etc.)

Indicator

Holiday


  • Sector to which the event belongs

Market, stock exchange

Gross domestic product (GDP)

Labour market

Prices

Money

Trade

Government

Business

Consumption

Housing

Taxes

Holidays


  • text name of the event in the language of the terminal (in the current encoding of the terminal)
  • time and date of event
  • reporting period of the event
  • current value of parameter
  • previous value of parameter
  • revised previous value of the indicator
  • forecasted value of indicator
  • potential impact on currency rate

No impact indicated

Positive impact

Negative impact


Unfortunately, except for the prohibition of opening positions before news releases I haven't found any other solutions. I want to find out which of them can be used and how to react to them.

As I understand it, the highlighted values are very important to decide how to react to the news, but I do not understand how. I invite discussion.

Here is my variant of the news indicator. The terminal provides information about news release time by currencies, the degree of importance is also selected. The info is shown as a vertical line on the price chart. In the sub-window you can see the histogram of the latest data values, in chronological order, relative to the forecast of the news, which has been categorized as important. Depending on the type of news (Interest Rates, Unemployment Rate, Consumer Price Index, GDP, etc.), the values can be plotted in chronological order. The obtained chart should be synchronized in time and scale with the price chart when switching the timeframe. Also I am interested in the speed of getting actual data.

 
Vladimir Kononenko:

Here is my version of the news indicator. It feeds the terminal with news release times for the currencies of your choice, the degree of importance is also selectable. The info is displayed with a vertical line on the price chart. In the sub-window we draw, in the chronological order, a histogram of the latest data values of the news, which are attributed to the class-important. The obtained chart should be synchronized in time with the price chart when switching the TF. The speed of getting actual data is also of interest.

You mean histograms for the full depth of history available on the chart?

But it does not give any information for real time application. Or have I completely misunderstood? Well, the forecast and the current value have been obtained, we have set the histogram, and then? Only manually make a decision?

I have not checked the speed of updating data in the calendar, and the speed of receiving ready data should be measured, but I have no such desire, because the speed is quite high.

Reason: