Skip to content
All library documents

Building an MQL5 Economic Calendar Database for News Backtesting

Article MQL5 articles

Summary

This article describes creating an SQLite database from MQL5 Economic Calendar data so that event information can be queried and later used in news-strategy testing. It discusses why stored calendar history is useful when the calendar itself is unavailable in the strategy tester, and demonstrates SQL queries for filtering events by country, sector, or importance. The database is intended to make historical event retrieval more organized than repeated code-level searches.

A central implementation concern is daylight saving time: broker server clocks and regional event schedules can shift differently. The article proposes separate date-handling classes for Australian, UK or European, and US daylight saving schedules, then applying the relevant adjustment when storing or reviewing event times. The approach depends on correctly identifying broker time conventions and maintaining accurate transition dates. The article covers data preparation and querying, not a tested news-entry strategy or evidence that trading event reactions is profitable.

Key ideas

  • Storing economic calendar records in SQLite makes historical events easier to query for later strategy testing.
  • The article uses SQL filters to retrieve events by attributes such as country and importance.
  • Broker time zones and regional daylight saving schedules can affect the recorded timing of news events.
  • Separate daylight saving schedules are proposed for Australian, UK or European, and US time conventions.
  • Reliable backtests depend on correctly aligning stored event timestamps with broker time.

Tags

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