Loading…

Event Reaction Recorder

Building a consistent before/during/after quote record around scheduled news releases by hand means sitting at the chart and manually reading Bid/Ask at the right second, every time, for every event that matters - it does not scale past a handful of releases. This EA reads a CSV calendar from the sandbox (the same schema used by NewsAutoFlat elsewhere in this catalogue - time_iso, currency, impact, title) and, for every event on a watched currency at or above a minimum impact level, captures a quote snapshot at each of a configurable list of offsets relative to the scheduled time - for example 5 minutes before, at the release itself, and 1, 5 and 15 minutes after. Each capture becomes one CSV row: the event's own details, the offset that triggered it, the capture time, and bid/ask/spread at that instant. Because the offsets are fully configurable, the same tool works for a tight around-the-print study or a longer post-event drift study without any code changes. The calendar file is re-scanned periodically so events can be added to it while the EA is running; already-tracked events, and which of their offsets have already been captured, are preserved across a re-scan rather than restarted, so a growing calendar never produces a duplicate capture. Notes and limitations - Snapshots are taken on the ATTACHED chart's symbol only. Attach one instance per symbol to cover more than one market against the same calendar file. - time_iso is parsed as literal wall-clock digits compared directly against server time - there is no time zone conversion. Export the calendar in the broker's server time, not UTC or local time, or the offsets will land at the wrong moment. - A title containing a comma will misalign that row's columns, since the parser does not support quoted CSV fields. - Captures are timer-driven and therefore approximate to the scan interval - an InpScanIntervalSec of 5 seconds means a capture can land up to 5 seconds after its exact due time, not at the literal instant. - This EA does not fetch or generate calendar data itself, and it never places, modifies or closes any order.

Expert advisor · MT5 · v1.0 · Free

About Event Reaction Recorder

Event Reaction Recorder is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 7 settings, such as Calendar file name, Watched currencies and Min impact. MQL source code included.

Files in the download: EventReactionRecorder.ex5, EventReactionRecorder.mq5, EventReactionRecorder.txt.

Settings

SettingDefaultWhat it does
Calendar file nameNewsCalendar.csvCalendar file, in MQL5\Files\ (the sandbox)
Watched currenciesUSD,EURComma-separated currency codes to watch
Min impactHighMinimum impact to track: High, Medium, Low, or Any
Offsets seconds-300,-60,0,60,300,900Comma-separated snapshot offsets from event time, seconds
Log file nameEventReactionRecorder.csvCSV log, in MQL5\Files\
Reload seconds300How often the calendar file is re-scanned for new events
Scan interval sec5Seconds between due-offset checks

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 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 · Alerts · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria