All about Calendar tab and Macro Economic Events. - page 2

 
Economic Calendar

The beginning:

  1. Indicators/EAs for news and trading signals - the thread
  2. Economic Calendar EA - the thread
  3. Economic Calendar EA - the second thread
  4. News Trader EA thread (MT4) 
  5. AvoidTheNews.mqh for short term systems - the thread with files
  6. News Reader Indicator! - the thread (MT4) 
  7. FF Calendar Indicator for MT - the thread (MT4) 

After

  1. All about Calendar tab and Macro Economic Events - the key thread
  2. MQL5 Cookbook – Economic Calendar - the article
  3. FFC - Forex Factory Calendar - indicator for MetaTrader 4 (and fixed version is on the post )
  4. HTML file converter for the economic calendar - script for MetaTrader 5
  5. News VLine - script for MetaTrader 5
  6. Calendar - script for MetaTrader 5
  7. NewsReleaseEA - expert for MetaTrader 4
  8. Can MQL5 Economic Calendar be used on the Strategy Tester? - the thread with some tools created
  9. Nonfarm Payrolls - expert for MetaTrader 5 
  10. Studying the CCanvas Class. How to Draw Transparent Objects - the article 
  11. Regression Analysis of the Influence of Macroeconomic Data on Currency Prices Fluctuation - the article  
  12. Building an Automatic News Trader - the article 
All about Calendar tab and Macro Economic Events.
All about Calendar tab and Macro Economic Events.
  • 2013.03.17
  • www.mql5.com
For traders MT5 user interface If you can't view the calendar tab, probably it's a choice a your broker : Video : How to delete Calendar Event...
 

950 websites broadcast the Economic Calendar from MetaQuotes

Almost a thousand web resources around the world feature the Economic Calendar widget. Among them are brokerage websites, popular financial media, analytical portals and trader blogs. The service allows sorting of macroeconomic events by their importance, country and time interval, while being legally burden-free — you do not have to worry about licensing risks.

950 websites broadcast the Economic Calendar from MetaQuotes

The MetaQuotes offer is valid for owners and webmasters of any resource. To add the Calendar, just click the "Add to website" button on the service web page. After specifying a width/height and a display period, the code is generated for you. Copy and paste it into a relevant web page of your preference. Now your visitors can have a ready-made tool for monitoring financial news.

 

Access to economic calendar data from MQL5 programs - read first post of this thread about HowTo 

----------------

    MQL5: Implemented access to economic calendar data from MQL5 programs.

    New functions

    CalendarCountryById — gets country description by identifier.
    bool CalendarCountryById(
       const long           country_id,    // country ID
       MqlCalendarCountry&  country        // country description
       );
    CalendarEventById — gets event description by identifier.
    bool CalendarEventById(
       const long           event_id,      // event ID
       MqlCalendarEvent&    event          // event description
       );
    CalendarValueById — gets event value description by identifier.
    bool CalendarValueById(
       const long           value_id,      // value ID
       MqlCalendarValue&    value          // value description
       );
    CalendarEventByCountry — gets the array of available events for the country.
    bool CalendarEventByCountry(
       string               country_code,  // country code
       MqlCalendarEvent&    events[]       // array of events
       );
    CalendarEventByCurrency — gets the array of available events for the affected currency.
    bool CalendarEventByCurrency(
       string               currency,      // currency
       MqlCalendarEvent&    events[]       // array of events
       );
    CalendarValueHistoryByEvent — gets the array of values for the specified time period, by event identifier.
    bool CalendarValueHistoryByEvent(
       ulong                event_id,      // event ID
       MqlCalendarValue&    values[],      // array of values
       datetime             datetime_from, // period beginning date
       datetime             datetime_to=0  // period end date
       );
    CalendarValueHistory — gets the array of values for the specified time period for all events, filtered by country and/or currency.
    bool CalendarValueHistory(
       MqlCalendarValue&    values[],          // array of values
       datetime             datetime_from,     // beginning of period
       datetime             datetime_to=0,     // end of period
       string               country_code=NULL, // country code
       string               currency=NULL      // currency
       );
    CalendarValueLastByEvent — gets an array of last event values by identifier. This function enables the request of the values which have appeared since the previous request. The in/out parameter "change_id" is additionally used for this operation.

    Every time the calendar database changes, the "change_id" property (the last change identifier) is updated. During data request, you specify "change_id" and the terminal returns events which appeared after that time, as well as the current "change_id" value, which can be used for the next request. During the first function call, specify the zero "change_id": the function will not return any events, but will return the current "change_id" for further requests.
    bool CalendarValueHistory(
       ulong                event_id,          // event ID
       ulong&               change_id,         // last calendar change ID
       MqlCalendarValue&    values[]           // array of values
       );
    CalendarValueLast — gets the array of last values for all events, filtered by country and/or currency. This function enables the request of the values which have appeared since the previous request. Similarly to CalendarValueLastByEvent, the "change_id" property is used for the request.
    bool CalendarValueHistory(
       ulong                event_id,          // event ID
       ulong&               change_id,         // last calendar change ID
       MqlCalendarValue&    values[],          // array of values
       string               country_code=NULL, // country code
       string currency=NULL                    // currency
       );

    New structures

    MqlCalendarCountry — country description.
    struct MqlCalendarCountry
      {
       ulong             id;                        // country ID in ISO 3166-1
       string            name;                      // text name of the country
       string            code;                      // code name of the country in ISO 3166-1 alpha-2
       string            currency;                  // country currency code
       string            currency_symbol;           // country currency symbol/sign
       string            url_name;                  // country name used in URL on mql5.com
      };
    MqlCalendarEvent — event description.
    struct MqlCalendarEvent
      {
       ulong                          id;           // event ID
       ENUM_CALENDAR_EVENT_TYPE       type;         // event type
       ENUM_CALENDAR_EVENT_SECTOR     sector;       // sector to which the event belongs
       ENUM_CALENDAR_EVENT_FREQUENCY  frequency;    // event release frequency
       ENUM_CALENDAR_EVENT_TIMEMODE   time_mode;    // event release time mode
       ulong                          country_id;   // country ID
       ENUM_CALENDAR_EVENT_UNIT       unit;         // unit for the event values
       ENUM_CALENDAR_EVENT_IMPORTANCE importance;   // event importance
       ENUM_CALENDAR_EVENT_MULTIPLIER multiplier;   // event importance multiplier
       uint                           digits;       // number of decimal places in the event value
       string                         source_url;   // source URL
       string                         event_code;   // event code
       string                         name;         // text name of the event in the terminal language
      };
    MqlCalendarValue — event value description.
    struct MqlCalendarValue
      {
       ulong             id;                        // value ID
       ulong             event_id;                  // event ID
       datetime          time;                      // event date and time
       datetime          period;                    // period, for which the event is published
       int               revision;                  // published indicator revision in relation to the reported period
       long              actual_value;              // current event value
       long              prev_value;                // previous event value
       long              revised_prev_value;        // revised previous event value
       long              forecast_value;            // forecast event value
       ENUM_CALENDAR_EVENT_IMPACRT impact_type;     // potential impact on the currency rate
      };

    New enumerations

    enum ENUM_CALENDAR_EVENT_FREQUENCY
      {
       CALENDAR_FREQUENCY_NONE            =0,   // not used
       CALENDAR_FREQUENCY_WEEK            =1,   // weekly
       CALENDAR_FREQUENCY_MONTH           =2,   // monthly
       CALENDAR_FREQUENCY_QUARTER         =3,   // quarterly
       CALENDAR_FREQUENCY_YEAR            =4,   // yearly
       CALENDAR_FREQUENCY_DAY             =5,   // daily
      };
    
    enum ENUM_CALENDAR_EVENT_TYPE
      {
       CALENDAR_TYPE_EVENT                =0,   // event (meeting, speech, etc.)
       CALENDAR_TYPE_INDICATOR            =1,   // indicator
       CALENDAR_TYPE_HOLIDAY              =2,   // holiday
      };
    
    enum ENUM_CALENDAR_EVENT_SECTOR
      {
       CALENDAR_SECTOR_NONE               =0,   // no
       CALENDAR_SECTOR_MARKET             =1,   // market
       CALENDAR_SECTOR_GDP                =2,   // GDP
       CALENDAR_SECTOR_JOBS               =3,   // jobs
       CALENDAR_SECTOR_PRICES             =4,   // prices
       CALENDAR_SECTOR_MONEY              =5,   // money
       CALENDAR_SECTOR_TRADE              =6,   // trade
       CALENDAR_SECTOR_GOVERNMENT         =7,   // government
       CALENDAR_SECTOR_BUSINESS           =8,   // business
       CALENDAR_SECTOR_CONSUMER           =9,   // consumer
       CALENDAR_SECTOR_HOUSING            =10,  // housing
       CALENDAR_SECTOR_TAXES              =11,  // taxes
       CALENDAR_SECTOR_HOLIDAYS           =12,  // holidays
      };
      
    enum ENUM_CALENDAR_EVENT_IMPORTANCE
      {
       CALENDAR_IMPORTANCE_LOW            =0,   // no
       CALENDAR_IMPORTANCE_NONE           =1,   // low
       CALENDAR_IMPORTANCE_MODERATE       =2,   // moderate
       CALENDAR_IMPORTANCE_HIGH           =3,   // high
      };
    
    enum ENUM_CALENDAR_EVENT_UNIT
      {
       CALENDAR_UNIT_NONE                 =0,   // no
       CALENDAR_UNIT_PERCENT              =1,   // percent
       CALENDAR_UNIT_CURRENCY             =2,   // national currency
       CALENDAR_UNIT_HOUR                 =3,   // number of hours
       CALENDAR_UNIT_JOB                  =4,   // number of jobs
       CALENDAR_UNIT_RIG                  =5,   // number of rigs
       CALENDAR_UNIT_USD                  =6,   // US dollar
       CALENDAR_UNIT_PEOPLE               =7,   // number of people
       CALENDAR_UNIT_MORTGAGE             =8,   // number of mortgages
       CALENDAR_UNIT_VOTE                 =9,   // number of votes
       CALENDAR_UNIT_BARREL               =10,  // number of barrels
       CALENDAR_UNIT_CUBICFEET            =11,  // volume in cubic feet
       CALENDAR_UNIT_POSITION             =12,  // number of job positions
       CALENDAR_UNIT_BUILDING             =13   // number of buildings
      };
      
    enum ENUM_CALENDAR_EVENT_MULTIPLIER
      {
       CALENDAR_MULTIPLIER_NONE           =0,   // no    
       CALENDAR_MULTIPLIER_THOUSANDS      =1,   // thousands
       CALENDAR_MULTIPLIER_MILLIONS       =2,   // millions
       CALENDAR_MULTIPLIER_BILLIONS       =3,   // billions
       CALENDAR_MULTIPLIER_TRILLIONS      =4,   // trillions
      };
      
    enum ENUM_CALENDAR_EVENT_IMPACRT
      {
       CALENDAR_IMPACT_NA                 =0,   // not available
       CALENDAR_IMPACT_POSITIVE           =1,   // positive
       CALENDAR_IMPACT_NEGATIVE           =2,   // negative
      };
    
    enum ENUM_CALENDAR_EVENT_TIMEMODE
      {
       CALENDAR_TIMEMODE_DATETIME         =0,   // the source publishes the exact time
       CALENDAR_TIMEMODE_DATE             =1,   // the event takes the whole day
       CALENDAR_TIMEMODE_NOTIME           =2,   // the source does not publish the event time
       CALENDAR_TIMEMODE_TENTATIVE        =3,   // the source provides only date, but does not publish the exact time in advance, exact time is added when event occurs
      };

    New error codes

    ERR_CALENDAR_MORE_DATA             =5400,   // the array is small for the whole result (values which fit in the array were passed)
    ERR_CALENDAR_TIMEOUT               =5401,   // timed out waiting for a response to the calendar data request
    ERR_CALENDAR_NO_DATA               =5402,   // data not found

 

Example of Economic calendar events listenter - 

Forum on trading, automated trading systems and testing trading strategies

New MQL5 Economic Calendar function

Rashid Umarov, 2019.03.20 17:10

May it is not that bug that coonects with your code. Run this sample of Economic calendar events listenter. Sorry for Russian comments - didn't have time for translation

//+------------------------------------------------------------------+
//|                                       Demo_CalendarValueLast.mq5 |
//|                        Copyright 2018, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property description "Пример использования функции CalendarValueLast"
#property description " для отлавливания выхода отчета по событию Nonfarm Payrolls."
#property description "Для этого необходимо получить текущий идентификатор изменения"
#property description " базы Календаря. И затем по этому идентификатору получать"
#property description " только новые события для через опрос в таймере"
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- create timer
   EventSetTimer(60);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- destroy timer
   EventKillTimer();
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---

  }
//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
//--- идентификатор изменения базы Календаря
   static ulong calendar_change_id=0;
//--- признак первого запуска
   static bool first=true;
//--- массив значений событий
   MqlCalendarValue values[];
//--- проведем инициализацию - получим текущий calendar_change_id
   if(first)
     {
      //--- получим идентификатор изменения базы Календаря   
      if(CalendarValueLast(calendar_change_id,values)>0)
        {
         //--- этот блок кода не может выполниться при первом запуске, но мы его все равно пропишем
         PrintFormat("%s: Получен текущий идентификатор базы Календаря: change_id=%d",
                     __FUNCTION__,calendar_change_id);
         //--- выставим флаг и выйдем до следущего события таймера
         first=false;
         return;
        }
      else
        {
         //--- данные не получены (для первого запуска это нормально), проверим наличие ошибки
         int error_code=GetLastError();
         if(error_code==0)
           {
            PrintFormat("%s: Получен текущий идентификатор базы Календаря: change_id=%d",
                        __FUNCTION__,calendar_change_id);
            //--- выставим флаг и выйдем до следущего события таймера
            first=false;
            //--- теперь у нас есть значение calendar_change_id
            return;
           }
         else
           {
            //--- а вот это действительно ошибка            
            PrintFormat("%s: Не удалось получить события в CalendarValueLast. Код ошибки: %d",
                        __FUNCTION__,error_code);
            //--- неудачное завершение работы, попробуем заново при следующем вызове таймера         
            return;
           }
        }
     }

//--- у нас есть последнее известное значение идентификатора изменения Календаря (change_id)
   ulong old_change_id=calendar_change_id;
//--- проверим - не появилось ли новое значение события "Nonfarm Payrolls"
   if(CalendarValueLast(calendar_change_id,values)>0)
     {
      PrintFormat("%s: Получены новые события для Календаря: %d",
                  __FUNCTION__,ArraySize(values));
      //--- выведем в Журнал информацию из массива values 
      ArrayPrint(values);
      //--- выведем в Журнал значения предыдущего и нового идентификатора Календаря
      PrintFormat("%s: Предыдущий change_id=%d, новый change_id=%d",
                  __FUNCTION__,old_change_id,calendar_change_id);
      //--- выведем в Журнал новые события
      ArrayPrint(values);
      /* 
      пропишите здесь свой код, который будет обрабатывать появление событий
      */
     }
//---     
  }
  
/*
   Пример работы слушателя:
   OnTimer: Получен текущий идентификатор базы Календаря: change_id=33281792
   OnTimer: Получены новые события для Календаря: 1
        [id] [event_id]              [time]            [period] [revision] [actual_value] [prev_value] [revised_prev_value] [forecast_value] [impact_type] [reserved]
   [0] 91040   76020013 2019.03.20 15:30:00 1970.01.01 00:00:00          0       -5077000     -1913000 -9223372036854775808         -4077000             2          0
   OnTimer: Предыдущий change_id=33281792, новый change_id=33282048
        [id] [event_id]              [time]            [period] [revision] [actual_value] [prev_value] [revised_prev_value] [forecast_value] [impact_type] [reserved]
   [0] 91040   76020013 2019.03.20 15:30:00 1970.01.01 00:00:00          0       -5077000     -1913000 -9223372036854775808         -4077000             2          0
   OnTimer: Получены новые события для Календаря: 1
        [id] [event_id]              [time]            [period] [revision]       [actual_value] [prev_value] [revised_prev_value] [forecast_value] [impact_type] [reserved]
   [0] 91041   76020013 2019.03.27 15:30:00 1970.01.01 00:00:00          0 -9223372036854775808     -5077000 -9223372036854775808         -7292000             0          0
   OnTimer: Предыдущий change_id=33282048, новый change_id=33282560
        [id] [event_id]              [time]            [period] [revision]       [actual_value] [prev_value] [revised_prev_value] [forecast_value] [impact_type] [reserved]
   [0] 91041   76020013 2019.03.27 15:30:00 1970.01.01 00:00:00          0 -9223372036854775808     -5077000 -9223372036854775808         -7292000             0          0
*/  
//+------------------------------------------------------------------+

 

Forum on trading, automated trading systems and testing trading strategies

Free economic calendar Tradays for WordPress sites

MetaQuotes Software Corp., 2019.04.23 09:35

We have released the Tradays integration plugin for WordPress. Now you can add the popular economic calendar in your website directly from the WordPress console, in addition to using the previously available widget.

The purpose of the Tradays service is to enable traders to perform fundamental financial market analysis. The calendar features over 900 indicators and events related to the 15 largest global economies. Current values are provided alongside historical data and future forecasts. The relevant indicator readings are automatically collected and updated in real time directly from public sources.

The Tradays plugin for WordPress

The Tradays WordPress Plugin is available free of charge without any forced advertising. The service is translated in 9 languages and is further expanding, while improvements and development updates are constantly released. The calendar use is absolutely burden-free.

The calendar can be easily added in your website:

  1. Install the plugin directly from the WordPress Plugins section or download the plugin files to "/wp-content/plugins/tradays-economic-calendar" folder
  2. Activate it under the Plugins section of the control panel
  3. Add a widget in the page using the Widgets section of the Appearance page

Install the Tradays plugin and provide to your site visitors an efficient tool for the evaluation and forecasting of financial asset quotes. Your audience will receive timely updates concerning global economies and will be able to track key financial news directly from your website.

Install Tradays for WordPress


 

Forum on trading, automated trading systems and testing trading strategies

The fastest economic calendar.

Renat Fatkhullin , 201.09.05.14 06:48

The calendar is delivered to the terminal automatically and in push mode. The calendar history is automatically synchronized at the start of the terminal.

Requests from MQL5 do not cause re-queries to the server, but work with a constantly updating local database.


 

Forum on trading, automated trading systems and testing trading strategies

Mexico is now featured in Tradays economic calendar

MetaQuotes Software Corp., 2019.09.18 09:34

32 Mexican economy indicators have been added to the fundamental market analysis app. Information is collected directly from public sources, such as the Bank of Mexico, Ministry of Finance and State Credit, the National Institute of Geography, Statistics and Informatics (INEGI).

By regularly checking the app, traders remain informed on the releases of all major Mexican economy indicators, from the Bank of Mexico Interest Rate decision to Gross Fixed Investments.


Mexico is now featured in Tradays economic calendar

The calendar is available as an online web version and as a mobile app:

The service features a web widget, which can be added in your website and aid in attracting new visitors. By inserting a few code lines, any webmaster can provide users with the free tool for monitoring global economic events.

Install the calendar >>


 
Alain Verleyen:

For traders

MT5 user interface

  • If you can't view the calendar tab, probably it's a choice a your broker :

Analysis

For developers

  • A good demonstration about using calendar economic events from code.
  • Documentation about object use by Calendar (See OBJ_EVENT).

Many thanks for the overview! However, I can't get the videos to play unfortunately. How do I show only selected Calendar Events on a chart, please?

All about Calendar tab and Macro Economic Events.
All about Calendar tab and Macro Economic Events.
  • 2013.03.17
  • www.mql5.com
For traders MT5 user interface If you can't view the calendar tab, probably it's a choice a your broker : Video : How to delete Calendar Events fro...
 

Calendar - script for MetaTrader 5

What can I apply for. For example, for subsequent loading into an array of dates and disabling / enabling trading before news releases. The code was written for yourself and provided for educational purposes. Therefore, do not expect special amenities. But you can always look at the code and understand how the time and importance of the event are obtained.

From the author -

Forum on trading, automated trading systems and testing trading strategies

News indicator for MT5

Dmitiry Ananiev , 2020/01/11 00:36

Now indicators are not needed. The built-in calendar can be shoved directly into the EA. Recently I posted a script ( https://www.mql5.com/en/code/27416 ). It writes to the news date file the strength of 2 and 3. For one character. The symbol can be set in the form of EU, US, AU, etc. Somewhere there should be a complete list of currencies. Help must be read.


Reason: