Spread and Slippage Cost Analyzer
- Utilities
-
Carlos Macaya Rodriguez
I build tools for MetaTrader 5 — trade and risk management utilities, panels, and diagnostics that work with the terminal's own data. - Version: 2.0
Do you know what it cost you to trade over the last three months? Not what you made or lost: what it cost you to open and close each position. This utility reads the closed history already on your account and tells you in money, measuring the spread that was quoted at the instant of each fill, entry and exit slippage, commission and swap. Nothing needs to have been installed beforehand. It only reads, it never sends an order.
The money you do not see
Every trade charges you four things. Two of them show up on your statement. The other two are hidden inside the result, which is why almost nobody adds them up.
- The spread. You buy a little dearer and sell a little cheaper than the price of the moment. Always. It never appears as an expense because it has already been taken out of the result.
- Slippage. You ask for a price and you get another one. It happens above all when a stop is hit or when the market moves fast.
- Commission. What the broker charges you to trade. It is the only one most people count.
- Swap. What you are charged, or paid, for holding a position overnight.
How it works
1. You drag it onto any chart. There is nothing to configure.
2. It reads your already closed trades and looks up in the tick archive what the market was quoting at the exact millisecond of each fill.
3. A minute later you have the report: what it cost you and where it went.
A real example
Small account, three months trading gold, 76 complete round trips.
What was left in the account: 102.38 EUR
What it cost to execute those trades: 48.10 EUR
What they would have returned without those costs: 150.48 EUR
Those 48.10 break down into 32.56 of spread, 8.92 of slippage, 6.62 of swap paid and 0.00 of commission. And what else the report pointed out:
- A third of the cost was concentrated in the worst ten per cent of the trades.
- Of the fills that did not come out at the price asked for, two out of three went against.
- The most expensive hour of the day cost three times what a normal hour did.
What you get
Every figure is broken down by symbol, by entry hour, by weekday, by session, by direction, by magic number and by how the position was closed. Slippage on stop loss exits is reported separately, because that is usually where the surprises are. You also see the ten most expensive round trips and how much of the total cost sits in them.
- An on-chart panel with five pages, anchorable to any corner.
- A standalone HTML report with the charts built in. No external files: it opens on any computer and prints cleanly.
- A CSV with one row per round trip, for your own spreadsheet.
What it does not do
- It does not trade. It does not open, close or touch your positions. It only reads.
- It does not invent. If your broker keeps no price history for a symbol, it tells you it could not measure there instead of filling the gap with an estimate.
- It does not judge your strategy. It measures what executing it costs, which is a different thing. A flawless broker does not turn a losing strategy into a winning one.
Try it with no history
If your account is new and has nothing to audit, it works just the same in the Strategy Tester: it builds a set of simulated trades and measures them against the real prices your broker has stored, so the execution figures describe that broker for real. No order is sent, and every screen says that the trade schedule is invented. Use the "Every tick based on real ticks" model: the OHLC and open price models generate ticks too far apart to time a fill, and when that happens the report says how many it left unmeasured.
Main parameters
- Period: last N days, a custom date range or the full available history.
- Filters: symbols with or without the broker suffix, magic numbers and ranges, direction and minimum volume.
- Measurement: quote lookup window in milliseconds, half or full spread per fill, and money conversion either automatic or from the tick value.
- Sessions: Asia, London and New York hours in server time, midnight crossing allowed.
- Panel: corner, offsets, font size, colours and automatic refresh interval.
- Reports: HTML and CSV switchable separately, CSV separator, export on the first audit, hide the account number and broker, report folder and name suffix.
- Strategy Tester demonstration: size, trades per day, holding time, assumed commission and stop distance.
Requirements
MetaTrader 5, no DLL. Works on hedging and netting accounts, on any symbol and any timeframe. Spread measurement needs the tick archive for the symbols you traded. The first run on a symbol may take a minute while the terminal downloads them; the panel and the report name the ones still missing, and the audit retries on its own for a few minutes.
Questions
If something in your report does not add up, ask in the product comments or send me a private message on MQL5. I read both, and a report that cannot be explained is exactly the kind of thing I want to hear about.
