Discussing the article: "MetaTrader 5 and the MQL5 Economic Calendar: How to Turn News into a Reproducible Trading System"

 

Check out the new article: MetaTrader 5 and the MQL5 Economic Calendar: How to Turn News into a Reproducible Trading System.

The article presents a systematic approach to news trading in MetaTrader 5 using the built-in economic calendar: data structure, API functions, time synchronization rules, and event filtering. Methods of caching and incremental updating without overloading the server are described. The article also provides a working mechanism for exporting history to an .EX5 resource for deterministic testing using the same algorithm.

The main problems of the modern news trader are fragmented toolset and the lack of a systematic, algorithmic trading workflow. It is pretty difficult to split your attention between your internet browser (browsing news sites) and your trading terminal while making trades.

A news trader's workflow looks like this: Quickly open the news calendar in your web browser and check for any changes in events → Quickly evaluate upcoming events and decide what and how to trade → Go to the MetaTrader 5 terminal – either place pending orders or sit at the terminal and wait for the news release to make a decision. In this scenario, the trader often experiences a loss of context, which leads to delays in reacting to news, which in turn leads to losses.

Do you want news trading to work like an engineering problem — with clear rules, repeatable results, and automated testing? The purpose of this article is to demonstrate the working architecture of a news layer for MetaTrader 5: a single data source, proper use of the calendar API, a filtering and caching mechanism, export of historical events to a resource for the tester, and automatic switching between Live and Tester — so that the same code produces deterministic results in both real time and historical data.


Author: MetaQuotes

 

Thanks for the article - very interesting - I'll look into how it works.... I myself wanted to use wyb codes and ai agents to connect through news and twitter parser - ts to make... you can also organise a hybrid mql5 with ai agents....

 
Roman Shiredchenko #:

Thanks for the article - very interesting - I'll look into how it works.... I myself wanted to use wyb codes and ai agents to connect through news and twitter parser - ts to make... you can also organise a hybrid mql5 with ai agents....

Why parsing something, if the whole vpisok with all details is already in the terminal? Yes and ii/ai is there too)
 
Dmitriy Skub #:
Why parsing something if the whole vpisok with all the details is already in the terminal? Yes and yi/ai is there too)

It's cool to watch.... and vibe code.... )

 

Written by:

Если брокер учитывает переход на летнее/зимнее время — календарь автоматически подстраивается под этот переход

Correct me if something has changed in MQL5 API, but previously the calendar was adjusted to the current time zone taking into account DST, i.e. in summer function requests return time stamps, for example, in the UTC+3 zone, while a request of the same history section in winter will get events with stamps in the UTC+2 zone, if the server switches to DST and vice versa. Thus, to accurately upload calendar history for six months or more, you need to analyse the broker's time zone translation history. More details in codobase.

Also, the approach with linking calendar cache as a resource seems little practical and, in particular, provokes the errors mentioned in the article itself (like, don't forget to recompile the EA). Why not set the calendar cache in the input parameter as a file from the Common folder available for all agents?

Economic Calendar Monitor and Cache for Backtesting on History
Economic Calendar Monitor and Cache for Backtesting on History
  • 2024.11.10
  • www.mql5.com
This indicator displays current events on the chart and allows you to export the calendar to archives for backtesting, automatically fixing time discrepancies between the history of bars and the history of events. This is an improved version of CalendarMonitorCached indicator from the algotrading book.
 
Correct me if something has changed in the MQL5 API, but previously the calendar was adjusted to the current time zone taking into account DST, i.e. in summer function requests return time stamps, for example, in the UTC+3 zone, while a request for the same history section in winter will get events with labels in the UTC+2 zone, if the server switches to DST and vice versa. Thus, to accurately upload the calendar history for half a year or more it is necessary to analyse the history of transfers часового пояса broker. More details in codobase.

and why quotes (in general all time stamps) are not kept for example in UTC ?

why dealers' ticks have different numerical representation of one and the same countdown of time

philosophical question :-) it's the way it's done, though it's wrong and causes problems on the spot.


ZЫ. so "historical news" is better to take from other sources.

And never need to "analyse the history of clock translation" - it's all there, it's a function of OS or system libraries. Google tzdata

how many bicycles can be made, and crooked ones at that

 
Stanislav Korotky #:

Previously, the calendar was adjusted to the current time zone taking into account DST, i.e. in summer function requests return time stamps, for example, in the UTC+3 zone, and a request for the same history section in winter will get events with stamps in the UTC+2 zone if the server switches to DST and back.

I have the same idea.
 
Maxim Kuznetsov #:


ZЫ. so "historical news" is better to take from other sources.

And you should never "analyse the history of clock translation" yourself - it's all there, it's a function of OS or system libraries. Google tzdata

how many bicycles can be made, and crooked ones at that


Other sources will not solve the problem, because it is buried in the way quotes are stored in MT5.

Show your straight bicycle first, and then give advice.