← All lessons

Costs and slippage

Every backtest number should be quoted after costs. · 7 min

ProOpen to everyone while Pro is in preview.

A real trade pays twice: commission to the broker and slippage, the gap between the price you planned and the price you got. A backtest that ignores them describes a market no one can trade.

Predict first

Two strategies earn +0.10R per trade before costs. One risks $0.30 per share, the other $3.00. Which loses more of its edge to the same per-share costs?

cost in R = (2 × commission + entry slippage + exit slippage) ÷ risk per share
net expectancy = gross expectancy − cost in R

When do costs eat the edge?

Costs are paid per share; the edge is earned per unit of risk. The tighter the stop, the bigger the same cost is in R.

cost in R = (2 × 0.005 + 2 × 2 × 0.01) ÷ 1.50 = 0.033R

Edge after costs +0.067R per trade

The edge survives, with 33% of it paid away in costs. The break-even stop for this cost is $0.50 per share.

Backtest a rule

A long-only daily rule on ten years of simulated candles, with the same fills as the chart simulator. Results in R; the equity curve risks 1% per trade.

The rule as steps
  1. At each daily close, check the signal: Up close.
  2. If it fires, buy at the next open (paying slippage).
  3. Stop: 2 × ATR(14) below the order price, measured at the signal close.
  4. Target: 2R above the entry (a resting limit order, no slippage).
  5. Each later day: a gap through the stop fills at the open; then a touch of the stop (checked before the target, the cautious reading) or of the target.
  6. Still open after 10 days: sell at that close.
  7. One trade at a time; the next signal counts only after the exit.

Running the numbers…

On ten years of the no-edge market, the “up close” rule earned −0.076R per trade before costs and −0.089R after a half cent a share and two ticks of slippage each way: +0.015R per trade, paid every time, win or lose.

Costs are paid per share, so the same cents weigh more on a cheap stock. Switch the lab to the trending market, a stop of 0.5 ATR, and compare a $100 stock with a $10 one: the same percentage moves, the same rule. At $100 the costs take +0.026R a trade and the rule keeps +0.117R. At $10they take +0.264R and leave −0.145R: a winning backtest turned into a losing strategy.

Worked example

Gross edge +0.12R, risk $0.80 per share, commission $0.005 each way, slippage $0.02 each way.

  • Round trip per share = 2 × 0.005 + 2 × 0.02 = $0.05
  • In R = 0.05 ÷ 0.80 = 0.0625R
  • Net = 0.12 − 0.0625 = +0.0575R: half the edge is gone.

Common mistake

Publishing a backtest without costs. It flatters every strategy, and most of all the busy ones with tight stops. Our rule: every statistic shows the costs it assumed, and a backtest without costs is labelled as such.

Strategy A: +0.25R gross, 40 trades a year, wide stops. Strategy B: +0.15R gross, 400 trades a year, stops of a few ticks. After realistic costs, which is likelier to survive?
Gross expectancy +0.06R, round-trip cost 0.08R. What is the result?

Closing round

Find the flawed backtest

Three reports on the same ten years. One of them could never be traded as written.

Building a fresh case…

Further reading: Chan, Quantitative Trading, chapter 3 (transaction costs).