Loading…

Terminal Timeline Builder

Reconstructing "what actually happened and when" after a difficult trading session usually means cross-referencing the terminal journal, the account history, and memory of when the connection dropped - three separate places telling three separate parts of the same story. This EA merges them. It polls the open-order pool every InpScanIntervalSec seconds and logs a TRADE OPEN the instant a new ticket appears and a TRADE CLOSE the instant a tracked ticket disappears (read back from history for its close price and net profit); it polls IsConnected() and logs CONNECTION LOST/RESTORED only on the edge, not every poll; and it runs three built-in threshold alerts - spread spike, low margin level, and equity drawdown from its running peak - each of which logs once per crossing and re-arms only once the reading has recovered clear of the threshold, so a value sitting right on the line does not spam the timeline. Every row carries a monotonic sequence number in addition to its timestamp, so the merged order across all four sources survives even when two events land inside the same one-second timestamp - a case a timestamp-only sort cannot resolve correctly on its own. Notes and limitations - Every source here is polled on InpScanIntervalSec, not pushed by the terminal. Two events inside the same poll gap are still ordered correctly relative to events from other polls, but not necessarily against each other within that gap. - Trade events cover open and close only, not stop-loss/take-profit modifications or partial closes as a separate event type - a partial close appears as one CLOSE for the closed ticket, per the house note that MQL4 opens a brand-new ticket for the remaining volume. - Tickets already open when the EA attaches are baselined without logging an OPEN event for them, since their true open time was never observed by this EA. - The alert thresholds are read from this account/symbol only. Attach one instance per account you want a timeline for. - This EA never places, modifies or closes any order - it only reads the order pool, connection state and account figures.

Expert advisor · MT4 · v1.0 · Free

About Terminal Timeline Builder

Terminal Timeline Builder is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 5 settings, such as Log file name, Scan interval sec and Spread alert points. MQL source code included.

Files in the download: TerminalTimelineBuilder.ex4, TerminalTimelineBuilder.mq4, TerminalTimelineBuilder.txt.

Settings

SettingDefaultWhat it does
Log file nameTerminalTimelineBuilder.csvCSV timeline, in MQL4\Files\
Scan interval sec2Seconds between polls of every source
Spread alert points50Alert when spread exceeds this many points
Margin level alert percent150.0Alert when margin level drops below this percent (0 = no open exposure, skipped)
Drawdown alert percent10.0Alert when equity drawdown from its peak exceeds this percent

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: Alerts · Trading Sessions · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria