Guide
Why a backtest without spread and commission lies, and how to test with real costs
Last updated November 21, 2026
A backtest that ignores spread and commission tests a market that does not exist. Many strategies that look good only look good because nothing was paid to enter.
What costs are
- Spread: the gap between the buy and the sell price. You pay it on every entry. It widens around news and at the daily reopen.
- Commission: a fee per lot on some accounts, usually charged on entry and exit.
- Swap: the cost or credit for holding a position overnight.
A short example
A strategy takes 400 trades a year, wins 55% of them, and aims for 10 pips with a 10 pip stop. Before costs it gains 400 × (0.55 × 10 − 0.45 × 10) = 400 pips. With a spread of 1.2 pips paid on each entry, the costs are 480 pips. The same strategy now loses 80 pips a year.
Four checks before you trust a backtest
- Real costs. The spread your broker actually charges on that symbol, and its commission.
- Your broker’s own prices. Candles from another feed can differ from what your account trades on.
- Unseen data. Tune on one period, then test on a later period the settings never saw.
- A harder test. Double the costs. Reverse the signal: if the reversed signal also wins, the result is probably luck or a trend in the data, not an edge.
How CandleWarden does it
CandleWarden’s backtests run on your broker’s own history and pay the spread and commission on every entry. Its «Study this bot» check runs a strategy on candles it was not built on, with doubled costs, and tests whether the reversed signal loses, then tells you plainly whether the result held.
Quick answers
How much do costs change a backtest?
It depends on how often the strategy trades and how small its targets are. A strategy that aims for a few pips per trade can turn from profit to loss once a spread of one or two pips is paid on every entry.
What is overfitting?
Tuning a strategy so closely to past prices that it fits their noise. It looks excellent on the data it was built on and fails on new data. Testing on a separate period it was not tuned on is the basic check.
Does a good backtest mean the strategy will make money?
No. It means the rules would have made money on that past data with the costs assumed. Markets change, and real fills, slippage and spreads differ. Treat a backtest as a filter, not a promise.
CandleWarden is a Windows app for MetaTrader 5 that keeps these rules for you: daily loss, news windows, lot size, trades per day and sessions, held by a guard inside MT5 even when the app is closed. Plans start at $19 a month, with a 7-day free trial.