Stop Distance Ledger
- Utilities
- Version: 1.10
- Updated: 6 September 2026
- Activations: 10
Stop Distance Ledger reads this account's own closed-trade history and shows how often a stop-loss or take-profit was actually set when a position was opened, and how far away it was placed - as a percentage of the opening price. It does not predict, judge or advise, and it never looks at trade results; it only measures what was set.
WHY THIS EXISTS
Deciding to always set a stop-loss before entering a trade is a rule many traders intend to follow, but rarely check against. The account's history tab lists trades one by one; it never adds up how many actually had a stop-loss attached, how many didn't, or how far away those stops were placed. "17 of 931 closed positions had a stop-loss - a rate of 1.8%" is a fact this account's own history already contains - it is just never counted.
SETUP
1. Drag the EA onto any chart. The symbol and timeframe do not matter - it reads the account's whole closed-trade history, not the chart it is running on.
2. A panel appears in the top-left corner and fills in from this account's own history.
3. It recalculates only when the number of closed deals changes, checked every 60 seconds. Nothing needs to be started or configured.
4. Nothing else is required. There are no numeric settings to tune.
INPUTS (four, in this order)
- InpShowPanel (true) - show or hide the panel.
- InpPanelCorner (top-left) - which of the four chart corners the panel sits in.
- InpPanelFontSize (9) - panel text size. Display only.
- InpColorText (white) - panel text colour.
There is no numeric threshold anywhere. The 365-day window is fixed and cannot be changed.
WHAT IT LOOKS AT: THE OPENING ORDER ONLY
This tool reads the stop-loss and take-profit that were set on the order that opened a position, at the moment it opened. MT5 does not keep a record of stop-loss or take-profit changes made afterward - modifying a position's stop later updates the position directly, without leaving any entry in the order history. This is a limitation of the platform, not of this tool: it is technically impossible to reconstruct a stop's full history of changes from account history alone. What this tool answers is "did this position start with a stop-loss, and how far away was it" - not "was the stop ever moved afterward."
WHAT THE PANEL SHOWS
The panel shows the stop-loss set rate for the last 365 days: the share of closed positions that started with a stop-loss, next to the raw count behind it. Below that, Take-profit set rate shows the same for take-profit, followed by the median stop-loss distance and median take-profit distance, both as a percentage of the opening price (a dash appears instead of a number when fewer than 5 positions had that stop set). By symbol lists the median stop-loss distance for up to 5 symbols, ranked by how many stop-losses were set, with anything beyond that folded into an Other symbols line. When there is no closed-trade history to judge, the panel says so in one line instead of leaving the section blank.
THE REPORT FILE
A CSV file is written to MQL5\Files\StopDistanceLedger\stop_distance_report.csv, broken down by month with columns: Month, Symbol, ClosedCount, SLSetCount, MedianSLPercent, TPSetCount, MedianTPPercent. A blank Symbol marks the overall row for that month. It is rewritten in full each time, not appended, so it never contains duplicates. Its full path is printed on the panel.
BEFORE YOU TEST IT
The Strategy Tester only has the closed-trade history from that one test run, so what you see there reflects the test period, not this account's real trading history. It is useful for confirming the EA runs without errors, not for reading its numbers as if they were real account data.
WHAT IT DOES NOT DO
It never places, closes or modifies a trade, and it never sets or changes a stop-loss or take-profit - it has no connection to the trade side of the terminal at all; it only reads what was already there when a position opened. It does not use trade results anywhere - only whether a stop-loss or take-profit was set, and how far away. It does not include open positions - only fully closed ones count. It does not judge whether a stop distance was too tight or too wide, and it does not suggest what distance to use. It reads one account on one terminal, going back only as far as this account's own trade history reaches.
