Skip to content
All library documents

Building an Offline Economic News Filter for Forex EAs

Article MQL5 articles

Summary

This article describes a file-based filter that reads a Forex Factory calendar CSV into structured event records and checks whether the current broker server time falls within a configured news window for a symbol. Its components parse dates, times, currencies, and impact levels; match a currency pair's base and quote currencies; apply severity and pre-event or post-event windows; and optionally draw those windows on a chart. A demo EA shows how to block trades during a matching event, while a verification script checks parsing and boundary behavior.

The offline design avoids a runtime network dependency, but the operator must refresh the file and ensure its timestamps are in broker server time. The article also notes limits in symbol-name matching and that the filter covers scheduled releases only, so surprise events and other volatility shocks pass through. The included assertions demonstrate implementation behavior, not trading performance or protection from execution losses.

Key ideas

  • The filter loads calendar events from a local CSV file at startup and checks news windows on demand.
  • Events can be filtered by currency and minimum impact, with inclusive time boundaries.
  • The calendar timestamps must match broker server time, which may require operator configuration.
  • A local file removes runtime network reliance but must be kept current.
  • The verification script checks parsing and filter logic rather than trading outcomes.

Tags

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