Filtering MQL5 Trades Around Economic News with Live and CSV Calendars
Summary
The document explains how an MQL5 Expert Advisor can use MetaTrader 5’s economic calendar to avoid trading around scheduled releases. It describes filtering events by importance, mapping a symbol’s currencies or market to relevant country codes, and applying pre-event and post-release pauses. It also proposes reducing position size on days with multiple events as an alternative to blocking entries entirely.
Because the live calendar is unavailable in Strategy Tester, a companion logger exports event data to CSV for backtests. The same filter can select between the live calendar and stored data, allowing the EA to use shared gate functions in both settings. The article outlines the API structures, symbol mapping, and example program components, but the provided text omits much of the implementation. Its approach covers scheduled releases and depends on the calendar’s impact classifications and the accuracy of symbol-to-country mappings; those may require manual adjustment. It explains the intended safeguards but provides no quantitative performance comparison establishing how much filtering improves results.
Key ideas
- The live MQL5 calendar can identify scheduled events and classify their importance.
- A news filter can monitor countries relevant to a traded symbol and pause entries around selected releases.
- A CSV export supplies calendar data to Strategy Tester, where the live calendar API is unavailable.
- Impact classifications and automatic symbol mappings can be imperfect, so manual overrides may be needed.
- Reducing position size offers an alternative to blocking trades on event-heavy days.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.