Trading math / 04
What Trading Costs Can an MT5 Backtest Miss?
An MT5 backtest can look profitable before costs and lose money after them. Check how the run handles spread, commission, slippage, and overnight financing, then compare the test fills with the execution assumptions used to generate them.
Check what the tester already includes
- Spread is the gap between the bid and ask. Real-tick testing can capture changes in spread within a minute. Generated ticks use the spread recorded for the relevant minute bar when available. If your test already uses the correct bid and ask fills, their spread is reflected in the P&L.
- Commission may be charged at entry, exit, or both. Compare the tester’s account settings with the fee schedule you are trying to represent.
- Slippage is the difference between a reference execution price and the fill price. MT5’s tester can model a delay on EA trade requests, during which price can change. Compare a no-delay run with a delay scenario. Neither measures how a live broker will fill every order.
- Overnight financing is a separate debit or credit on positions held through the relevant rollover. Verify the symbol’s long and short swap settings, including the day with a multiple-day charge. MT5’s profit-in-pips test mode omits commission and swap.
A 50-trade cost ledger
Suppose a mid-price model shows $180 gross across 50 trades. It has no costs included, so the following are additional hypothetical adjustments. For a run built from simulated bid and ask fills, omit any spread or slippage adjustment already reflected in those prices.
| Extra cost | Assumption | Total |
|---|---|---|
| Spread | $1.20 per completed trade | $60 |
| Commission | $0.80 round trip | $40 |
| Adverse slippage | $1.40 per completed trade | $70 |
| Overnight financing | $18 net charge across the positions held through rollover | $18 |
Net outcome = $180 − $60 − $40 − $70 − $18 = −$8.
Reconcile the run before changing the strategy
Keep the symbol, dates, sizing and EA inputs fixed while you test one cost assumption at a time. Record the tick mode, delay, commission and swap settings. Compare gross and net P&L, trade count, and representative entry and exit prices. If changing the execution model changes which orders filled, treat the runs as different trade sets. Compare individual fills before attributing the whole P&L difference to one cost.
Use the trading costs calculator for a round-trip estimate, then check how the resulting cost changes the break-even win rate.
Watch the short
3 Trading Costs Your Backtest Can Miss
Sources
Discuss it with RealTradeMaster
Compare test assumptions and learn how to read the community’s public signal results.