Discussing the article: "Developing a Calendar-Based News Event Breakout Expert Advisor in MQL5"

 

Check out the new article: Developing a Calendar-Based News Event Breakout Expert Advisor in MQL5.

Volatility tends to peak around high-impact news events, creating significant breakout opportunities. In this article, we will outline the implementation process of a calendar-based breakout strategy. We'll cover everything from creating a class to interpret and store calendar data, developing realistic backtests using this data, and finally, implementing execution code for live trading.

While the MQL5 community offers numerous articles and codebases on handling MetaTrader 5 calendars in backtesting, these resources can be overly complex for beginners aiming to develop a simple breakout strategy. This article seeks to simplify the process of creating a strategy using the news calendar in MQL5 and provide a comprehensive guide for traders.

The motivation for creating a calendar news breakout trading strategy lies in leveraging the predictable timing of scheduled news events—such as economic reports, earnings releases, or geopolitical announcements—that often trigger significant market volatility and price movements. By anticipating these events, traders aim to capitalize on breakout opportunities when prices move decisively beyond established support or resistance levels following the news. This strategy seeks to maximize profits from increased liquidity and momentum around news releases while employing disciplined risk management to navigate the heightened uncertainty. Ultimately, it provides a structured approach to exploit the patterns and reactions that typically occur in the markets around key calendar events.

Author: Zhuo Kai Chen

 

Hi, this is great thanks! I'm a bit confused about entering multiple currencies. I've tried:

"USD";"GBP"

"USD";"GBP.

"USD" "GBP";

Only the last one doesn't produce an error, but i'm not sure it works correctly. Maybe it only picks up the USD. Can you advise?

 
hrawoodward #:

Hi, this is great thanks! I'm a bit confused about entering multiple currencies. I've tried:

"USD";"GBP"

"USD";"GBP.

"USD" "GBP";

Only the last one doesn't produce an error, but i'm not sure it works correctly. Maybe it only picks up the USD. Can you advise?

Hello, if you look at the code in the initialization function, it will split the colon and store different currencies into the curr object attribute. You first one should work, although you don't need to add the quotations. The storing process will store all the events into the binary file regardless of their attributes. Only in trade logic will we filter for the attributes. Here's what I have run just now:

settings

result

 
It looks like this implementation does not look at timezone switches (DST) on the broker server and hence produces inaccurate results during backtesting and optimizations.
 
Stanislav Korotky #:
It looks like this implementation does not look at timezone switches (DST) on the broker server and hence produces inaccurate results during backtesting and optimizations.

Thanks for reminding me! I forgot to consider it in the article cuz I used a broker that doesn't have DST for demonstration.

https://www.mql5.com/en/book/advanced/calendar

From this source we know that the calendar data is provided from the MQL5 side, and it is automatically adjusted to the broker's current Timetradeserver() time zone, meaning that for brokers with DST would need to adjust my code and take it into account.

MQL5 Book: Advanced language tools / Economic calendar
MQL5 Book: Advanced language tools / Economic calendar
  • www.mql5.com
When developing trading strategies, it is desirable to take into account the fundamental factors that affect the market. MetaTrader 5 has a...
 
Zhuo Kai Chen #:

From this source we know that the calendar data is provided from the MQL5 side, and it is automatically adjusted to the broker's current Timetradeserver() time zone, meaning that for brokers with DST would need to adjust my code and take it into account.

Since the published in the book implementation is a bit outdated, the actual (updated) story can be found in the blog and the codebase (indicator) and in the codebase (script).

Backtesting news trading based on economic calendar history with adjusted timings
Backtesting news trading based on economic calendar history with adjusted timings
  • 2025.05.14
  • www.mql5.com
This blogpost presents some further results of experiments with news trading based on the built-in calendar of MetaTrader 5 and MQL5. Originally, the idea was implemented in the algotrading book as a
This website uses cookies. Learn more about our Cookies Policy.