Skip to content
All library documents

Building MQL5 News Filters with Currency Matching and Event Windows

Article MQL5 articles

Summary

This article describes an MQL5 Economic Calendar filter that restricts new entries around scheduled events. It loads and caches calendar data, filters events by importance, and compares each event’s currency with currencies associated with the traded symbol. Configurable pre-event and post-event buffers define when the restriction is active. The design also includes an optional rule to close positions before high-impact releases and a manual testing mode for triggering sample event times.

The examples show how relevance and timing combine: a matching currency inside an enabled event window can block entries, while unrelated currencies or times outside the window do not. The article argues that the terminal’s calendar avoids external web requests and supports controlled testing. Its reliability depends on broker calendar coverage and server time; symbol mapping uses heuristics that may miss custom instruments, for which a manual currency override is available. Advanced stop handling and restart recovery are outside this installment’s scope.

Key ideas

  • The filter uses the terminal’s economic calendar and caches event data to limit repeated queries.
  • It matches event currencies to currencies associated with the traded symbol.
  • Importance settings and configurable pre-event and post-event buffers determine active restrictions.
  • An optional rule can close positions before high-impact events, in addition to blocking new entries.
  • Broker calendar coverage, server time differences, and heuristic symbol mapping limit reliability.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.