Backtesting Without Fooling Yourself

lesson 4 of 5

Costs, slippage and fills

A backtest that ignores trading costs describes a market that does not exist. For strategies that trade often or aim for small moves, costs can be the difference between a result that looks positive and one that is not.

The costs to include

  • Commissions and exchange fees, charged per contract per side.
  • The bid-ask spread, which matters especially in forex and in thinner futures contracts.
  • Slippage: the difference between the price a rule expected and the price a real order would likely receive.

Fill assumptions

Limit orders are a particular trap. A backtest may assume a limit order filled whenever price touched it, but in reality price can touch a level without the order being filled, because other orders were ahead in the queue. A conservative test only counts a limit fill when price trades through the level.

Stop orders have the opposite problem: they can fill worse than their price in fast markets.

Educational content only. Not financial advice.