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.
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.
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 valuesdatetime datetime_from, // period beginning datedatetime 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 valuesdatetime datetime_from, // beginning of perioddatetime datetime_to=0, // end of periodstring country_code=NULL, // country codestring 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 IDulong& 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 IDulong& change_id, // last calendar change ID
MqlCalendarValue& values[], // array of valuesstring country_code=NULL, // country codestring currency=NULL // currency
);
New structures
MqlCalendarCountry — country description.
struct MqlCalendarCountry
{
ulong id; // country ID in ISO 3166-1string name; // text name of the countrystring code; // code name of the country in ISO 3166-1 alpha-2string currency; // country currency codestring currency_symbol; // country currency symbol/signstring 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 modeulong 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 multiplieruint digits; // number of decimal places in the event valuestring source_url; // source URLstring event_code; // event codestring name; // text name of the event in the terminal language
};
MqlCalendarValue — event value description.
struct MqlCalendarValue
{
ulong id; // value IDulong event_id; // event IDdatetime time; // event date and timedatetime period; // period, for which the event is publishedint revision; // published indicator revision in relation to the reported periodlong actual_value; // current event valuelong prev_value; // previous event valuelong revised_prev_value; // revised previous event valuelong 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
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 |//+------------------------------------------------------------------+intOnInit()
{
//--- create timerEventSetTimer(60);
//---return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Expert deinitialization function |//+------------------------------------------------------------------+voidOnDeinit(constint reason)
{
//--- destroy timerEventKillTimer();
}
//+------------------------------------------------------------------+//| Expert tick function |//+------------------------------------------------------------------+voidOnTick()
{
//---
}
//+------------------------------------------------------------------+//| Timer function |//+------------------------------------------------------------------+voidOnTimer()
{
//--- идентификатор изменения базы Календаряstaticulong calendar_change_id=0;
//--- признак первого запускаstaticbool first=true;
//--- массив значений событий
MqlCalendarValue values[];
//--- проведем инициализацию - получим текущий calendar_change_idif(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_idreturn;
}
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
*///+------------------------------------------------------------------+
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 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:
Install the plugin directly from the WordPress Plugins section or download the plugin files to "/wp-content/plugins/tradays-economic-calendar" folder
Activate it under the Plugins section of the control panel
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.
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.
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.
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.
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.
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.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
The beginning:
After
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.
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.
CalendarEventById — gets event description by identifier.
CalendarValueById — gets event value description by identifier.
CalendarEventByCountry — gets the array of available events for the country.
CalendarEventByCurrency — gets the array of available events for the affected currency.
CalendarValueHistoryByEvent — gets the array of values for the specified time period, by event identifier.
CalendarValueHistory — gets the array of values for the specified time period for all events, filtered by country and/or 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.
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.
New structures
MqlCalendarCountry — country description.
MqlCalendarEvent — event description.
MqlCalendarValue — event value description.
New enumerations
New error codes
MQL5 Reference - Economic Calendar - CalendarValueLastByEvent
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
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 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:
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.
The calendar is available as an online web version and as a mobile app:
Tradays for Android
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 >>
For traders
MT5 user interface
Analysis
For developers
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?
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.