Trade History Integrity Checker
Most traders only find out an order was modified, partially closed, or touched by something other than their own EA when they happen to notice the number looks wrong. This tool watches instead of trusting: it keeps a snapshot of every open order's lots, stop loss and take profit, and on every tick compares the current state against the last snapshot. Any difference is logged immediately with the old value and the new one side by side. The case that matters most is the one nobody checks for: an order that disappears from the open trade pool. The honest expectation is that a closed order has a matching row in account history. This EA confirms that directly, by looking the vanished ticket up with OrderSelect(ticket, SELECT_BY_TICKET, MODE_HISTORY). When that lookup fails, the ticket is flagged as missing - gone from the live pool with nothing in history to show what happened to it. That gap is exactly the kind of silent inconsistency that lets manual interference, a synchronisation problem, or a broker-side issue go unnoticed until it costs money at reconciliation time. This EA places no orders, modifies nothing, and never intervenes. It only watches and reports, on-chart, in the terminal journal, and optionally to a CSV log for later review. Notes and limitations - Read-only. This EA never sends, modifies or closes an order - it only watches orders/positions that exist for other reasons. - It can only track tickets it has actually seen open at least once, starting from when it was attached. A position that opens and closes between two of this EA's ticks in a fast market could be missed if the platform is not processing ticks; this is inherent to any tick-driven program on either platform. - A "missing ticket" flag is a prompt to check account history manually, not proof of wrongdoing - some brokers delay history synchronisation briefly after a fast close.
Expert advisor · MT4 · v1.0 · Free
About Trade History Integrity Checker
Trade History Integrity Checker 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 Magic filter, Current symbol only and Alert on modification. MQL source code included.
Files in the download: TradeHistoryIntegrityChecker.ex4, TradeHistoryIntegrityChecker.mq4, TradeHistoryIntegrityChecker.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Magic filter | -1 | Magic number filter, -1 = watch every magic number |
| Current symbol only | false | Restrict watching to this chart's symbol |
| Alert on modification | true | Pop an alert when a watched order's lots/SL/TP change |
| Alert on missing ticket | true | Pop an alert when a ticket vanishes with no history record |
| Log to file | true | Append every detected event to a CSV in the sandbox Files folder |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Risk & Lot Size · Alerts · MT4 Expert Advisor · MQL4 Source Code