Trading Cost Ledger
- Utilities
- Version: 1.10
- Updated: 16 September 2026
- Activations: 10
Trading Cost Ledger reads this account's own closed deal history and adds up exactly two things: commission and swap. It does not predict and it does not advise. Every figure it shows already happened on this account.
SETUP
1. Drag the EA onto any chart. The symbol and timeframe do not matter - it reads the whole account, not the chart.
2. A panel appears in the top-left corner and fills in from the first tick.
3. The CSV report is written automatically at startup. Its full path is printed on the panel, so there is nothing to look up.
4. Nothing else is required. There are no numeric settings to tune.
INPUTS (five, 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.
- InpWriteCsv (true) - write the CSV report, or not. Turning it off removes the CSV line from the panel.
There is no numeric threshold anywhere. The 365-day window and the 5-deal minimum sample are both fixed and cannot be changed.
WHAT THE PANEL SHOWS
- Total commission (365d) - the commission recorded on each closed deal, added up.
- Total swap (365d) - the swap recorded on each closed deal, added up with its sign kept. A positive total means the account received more swap than it paid.
- Trading cost (365d) - the commission total plus whatever part of the swap total was a payment. A positive swap balance is simply not added; it never turns the cost negative.
- A percentage above them, in the panel's largest type - that trading cost divided by the sum of every closed deal that finished on the plus side in the same window. It is one ratio only; the underlying deal amounts are not shown.
- Highest-cost symbol - the single symbol whose commission and swap payments added up to the largest amount over the same 365 days, with that amount beside it.
- Highest-cost weekday - the weekday whose commission and swap payments added up to the largest amount over the same 365 days, with that amount beside it.
- State - OK, or "Collecting history" when fewer than 5 qualifying deals exist in the window.
THE CSV REPORT
Written to: MQL5\Files\TradingCostLedger\cost_report.csv (the folder is created if missing).
Columns: Month, Symbol, CommissionTotal, SwapTotal, TradingCostTotal, DealCount - one row per symbol per month.
The file is rewritten in full each time, not appended, so it never contains duplicates.
BEFORE YOU TEST IT
The Strategy Tester's account history contains only the deals made inside that one test run, so a fresh test will normally show "Collecting history" from start to finish. That is how the Tester works, not a fault in the tool. Loaded on a live or demo account that already has trading history, the panel and the CSV fill in from the first tick.
WHAT IT DOES NOT DO
It never places, closes or modifies an order; it has no connection to the trade side of the terminal. It uses no technical indicator and no second timeframe - the only material is each closed deal's own commission, swap, symbol and time. It does not estimate spread cost, because a closed deal's record does not keep the market price at the moment it was placed. It does not compare brokers, does not suggest avoiding a symbol, and does not forecast anything. It reads one account on one terminal, and excludes deposits, withdrawals and other non-trade balance operations.
SCREENSHOTS
Screenshot 1 - USDJPY M15, a demo account that already had real trading history. The headline reads 6.4% - what commission and swap came to, measured against every closed deal that finished on the plus side over the last 365 days - with Trading cost (365d) 94403.00 JPY on the line beneath it. Below the rule, Total commission (365d) and Total swap (365d) share one row, Highest-cost symbol reads BTCUSD 94249.00 JPY, Highest-cost weekday reads Wednesday 94249.00 JPY, the CSV report path is printed along the bottom and State reads OK. On this account the swap total is long enough that the column shortens it to -94385..., and the commission column beside it is left blank at this font size; both totals are written out in full in the CSV report. Every figure is what this account's own closed deal history held at the moment of capture - not a placeholder, not an estimate.
Screenshots 2 to 4 are the same panel, on the same account, at the same moment, read three ways. Screenshot 2 enlarges the block under the headline so the two highest-cost rows can be read at full size, below the row that carries the commission and swap totals. Screenshot 3 puts another corner, a smaller font and a larger font side by side, which is what the display inputs actually control. Screenshot 4 sets out what the tool does not do. Those inputs move only where the panel sits, how large its text is, what colour it has and whether the CSV report is written - the figures themselves come from this account's own history rather than from the chart in front of it.
RELATED TOOLS FROM THE SAME AUTHOR
This ledger belongs to a small set of account-history tools from the same author. Three of them are free, no-advice indicators - Trade Behavior Mirror, Win Streak Size Creep Mirror and Multi Symbol Chase Mirror - and they read the same kind of closed history to show entries placed shortly after a loss, lot size growth during a run of deals that closed on the plus side, and how many different symbols were traded. This is the first paid tool in that line, for anyone who wants the cost side of the same history rather than the behavior side. The same author's MQL5 profile also lists paid MT5 indicators and utilities for gold-specific signals, trade risk limits and backtest-versus-live auditing.
