Economic Сalendar structures

This section describes the structures for working with the economic calendar available directly in the MetaTrader platform. The economic calendar is a ready-made encyclopedia featuring descriptions of macroeconomic indicators, their release dates and degrees of importance. Relevant values of macroeconomic indicators are sent to the MetaTrader platform right at the moment of publication and are displayed on a chart as tags allowing you to visually track the required indicators by countries, currencies and importance.

Economic calendar functions allow conducting the auto analysis of incoming events according to custom importance criteria from a perspective of necessary countries/currency pairs.

Country descriptions are set by the MqlCalendarCountry structure. It is used in the CalendarCountryById() and CalendarCountries() functions

struct MqlCalendarCountry
  {
   ulong                               id;                    // country ID (ISO 3166-1)
   string                              name;                  // country text name (in the current terminal encoding)
   string                              code;                  // country code name (ISO 3166-1 alpha-2)
   string                              currency;              // country currency code
   string                              currency_symbol;       // country currency symbol
   string                              url_name;              // country name used in the mql5.com website URL
  };

 

Event descriptions are set by the MqlCalendarEvent structure. It is used in the CalendarEventById(), CalendarEventByCountry() and CalendarEventByCurrency() functions

struct MqlCalendarEvent
  {
   ulong                               id;                    // event ID
   ENUM_CALENDAR_EVENT_TYPE            type;                  // event type from the ENUM_CALENDAR_EVENT_TYPE enumeration
   ENUM_CALENDAR_EVENT_SECTOR          sector;                // sector an event is related to
   ENUM_CALENDAR_EVENT_FREQUENCY       frequency;             // event frequency
   ENUM_CALENDAR_EVENT_TIMEMODE        time_mode;             // event time mode
   ulong                               country_id;            // country ID
   ENUM_CALENDAR_EVENT_UNIT            unit;                  // economic indicator value's unit of measure
   ENUM_CALENDAR_EVENT_IMPORTANCE      importance;            // event importance
   ENUM_CALENDAR_EVENT_MULTIPLIER      multiplier;            // economic indicator value multiplier
   uint                                digits;                // number of decimal places
   string                              source_url;            // URL of a source where an event is published
   string                              event_code;            // event code
   string                              name;                  // event text name in the terminal language (in the current terminal encoding)
  };

 

Event values are set by the MqlCalendarValue structure. It is used in the CalendarValueById(), CalendarValueHistoryByEvent(), CalendarValueHistory(), CalendarValueLastByEvent() and CalendarValueLast() functions

struct MqlCalendarValue
  {
   ulong                               id;                    // value ID
   ulong                               event_id;              // event ID
   datetime                            time;                  // event time and date
   datetime                            period;                // event report period
   int                                 revision;              // released indicator's revision in relation to a report period
   long                                actual_value;          // indicator's actual value
   long                                prev_value;            // indicator's previous value
   long                                revised_prev_value;    // indicator's revised previous value
   long                                forecast_value;        // indicator's forecast value
   ENUM_CALENDAR_EVENT_IMPACT          impact_type;           // potential impact on an exchange rate
  };

 

Event frequency is specified in the MqlCalendarEvent structure. Possible values are set in the listing ENUM_CALENDAR_EVENT_FREQUENCY

ID

Description

CALENDAR_FREQUENCY_NONE

Release frequency is not set

CALENDAR_FREQUENCY_WEEK

Released once a week

CALENDAR_FREQUENCY_MONTH

Released once a month

CALENDAR_FREQUENCY_QUARTER

Released once a quarter

CALENDAR_FREQUENCY_YEAR

Released once a year

CALENDAR_FREQUENCY_DAY

Released once a day

 

Event type is specified in the MqlCalendarEvent structure. Possible values are set in the listing ENUM_CALENDAR_EVENT_TYPE

ID

Description

CALENDAR_TYPE_EVENT

Event (meeting, speech, etc.)

CALENDAR_TYPE_INDICATOR

Indicator

CALENDAR_TYPE_HOLIDAY

Holiday

 

A sector of the economy an event is related to is specified in the MqlCalendarEvent structure. Possible values are set in the listing ENUM_CALENDAR_EVENT_SECTOR

ID

Description

CALENDAR_SECTOR_NONE

Sector is not set

CALENDAR_SECTOR_MARKET

Market, exchange

CALENDAR_SECTOR_GDP

Gross Domestic Product (GDP)

CALENDAR_SECTOR_JOBS

Labor market

CALENDAR_SECTOR_PRICES

Prices

CALENDAR_SECTOR_MONEY

Money

CALENDAR_SECTOR_TRADE

Trading

CALENDAR_SECTOR_GOVERNMENT

Government

CALENDAR_SECTOR_BUSINESS

Business

CALENDAR_SECTOR_CONSUMER

Consumption

CALENDAR_SECTOR_HOUSING

Housing

CALENDAR_SECTOR_TAXES

Taxes

CALENDAR_SECTOR_HOLIDAYS

Holidays

 

Event importance is specified in the MqlCalendarEvent structure. Possible values are set in the listing ENUM_CALENDAR_EVENT_IMPORTANCE

ID

Description

CALENDAR_IMPORTANCE_NONE

Importance is not set

CALENDAR_IMPORTANCE_LOW

Low importance

CALENDAR_IMPORTANCE_MODERATE

Medium importance

CALENDAR_IMPORTANCE_HIGH

High importance

 

Measurement unit type used in displaying event values is specified in the MqlCalendarEvent structure. Possible values are set in the listing ENUM_CALENDAR_EVENT_UNIT

ID

Description

CALENDAR_UNIT_NONE

Measurement unit is not set

CALENDAR_UNIT_PERCENT

Percentage

CALENDAR_UNIT_CURRENCY

National currency

CALENDAR_UNIT_HOUR

Hours

CALENDAR_UNIT_JOB

Jobs

CALENDAR_UNIT_RIG

Drilling rigs

CALENDAR_UNIT_USD

USD

CALENDAR_UNIT_PEOPLE

People

CALENDAR_UNIT_MORTGAGE

Mortgage loans

CALENDAR_UNIT_VOTE

Votes

CALENDAR_UNIT_BARREL

Barrels

CALENDAR_UNIT_CUBICFEET

Cubic feet

CALENDAR_UNIT_POSITION

Non-commercial net positions

CALENDAR_UNIT_BUILDING

Buildings

 

In some cases, economic parameter values require a multiplier set in the MqlCalendarEvent structure. Possible multiplier values are set in the listing ENUM_CALENDAR_EVENT_MULTIPLIER

ID

Description

CALENDAR_MULTIPLIER_NONE

Multiplier is not set

CALENDAR_MULTIPLIER_THOUSANDS

Thousands

CALENDAR_MULTIPLIER_MILLIONS

Millions

CALENDAR_MULTIPLIER_BILLIONS

Billions

CALENDAR_MULTIPLIER_TRILLIONS

Trillions

 

Event's potential impact on a national currency rate is indicated in the MqlCalendarValue structure. Possible values are set in the listing ENUM_CALENDAR_EVENT_IMPACT

ID

Description

CALENDAR_IMPACT_NA

Impact is not set

CALENDAR_IMPACT_POSITIVE

Positive impact

CALENDAR_IMPACT_NEGATIVE

Negative impact

 

Event time is specified in the MqlCalendarEvent structure. Possible values are set in the listing ENUM_CALENDAR_EVENT_TIMEMODE

ID

Description

CALENDAR_TIMEMODE_DATETIME

Source publishes an exact time of an event

CALENDAR_TIMEMODE_DATE

Event takes all day

CALENDAR_TIMEMODE_NOTIME

Source publishes no time of an event

CALENDAR_TIMEMODE_TENTATIVE

Source publishes a day of an event rather than its exact time. The time is specified upon the occurrence of the event.

 

See also

Economic Calendar