Loading…

Event Horizon Tracker

News-avoidance timers and pre-event flatten logic both need the same underlying answer: how long until the next event that matters, filtered to the currencies and impact levels the caller actually cares about. This library loads a small documented event list and answers exactly that. The CSV format is deliberately minimal - timestamp, currency code, impact level 1-3, title - closer to what an economic-calendar export tool actually produces than a general-purpose format would be. IcsCalendarParser.mqh elsewhere in this catalogue already parses the RFC 5545 ICS calendar format, but house style requires every Library submission to stand alone with no #include of another project, so this header cannot reuse it directly; a CSV format was the simpler and more directly maintainable choice for a hand-edited or scripted economic calendar anyway. EhtLoadCalendar sorts the loaded events by time once, so every query function can assume ascending order rather than re-sorting per call. EhtSecondsToNextEvent and EhtFindEventsInWindow both take the same filterCurrency/minImpact pair, so the same filter definition drives a single "what's next" query and a "what's coming in the next N days" window scan identically. Notes and limitations - All timestamps are read and compared as plain MQL4 datetime values (server time by convention); the CSV format carries no time zone information, so a mixed-time-zone source feed must be normalised to one zone before loading. - The loader tolerates '#' comment and blank lines but otherwise skips any row it cannot parse silently rather than raising an error - compare the returned count against the file's expected row count when debugging a calendar file. - Impact is read as a plain 1-3 integer and clamped into that range on load; this library assigns no meaning to the numbers beyond ordering - the caller decides what "high impact" means for their own use. - EhtSecondsToNextEvent and EhtFindEventsInWindow both scan linearly; fine for the tens-to-low-hundreds of events a realistic calendar file holds, not intended for a tick-by-tick high-frequency event stream.

Script · MT4 · v1.0 · Free

About Event Horizon Tracker

Event Horizon Tracker is a script for MetaTrader 4. It has 2 settings, such as Calendar file and From time. MQL source code included.

Files in the download: EventHorizonTracker.mqh, EventHorizonTracker.txt, EventHorizonTrackerDemo.mq4.

Settings

SettingDefaultWhat it does
Calendar fileEventHorizonTrackerDemo.csvSandbox Files\ filename for the sample calendar
From time2026.08.19 00:00Reference "now" for the demo queries

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: News Trading · MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria