Costs and Slippage in Backtests
Ignoring costs is the fastest way to fool yourself in a backtest. Learn the costs to include, how to estimate slippage and market impact, and conservative rules.
Many strategies that look profitable on paper are wiped out by trading costs. Commissions, spreads, slippage, market impact, financing and borrowing fees all reduce returns, and they matter most for strategies that trade often or target small moves. Modelling costs realistically, and conservatively, is one of the most important parts of a backtest. The general cost concepts are covered in All-In Trading Cost; this lesson focuses on putting them into backtests.
Costs to include#
| Cost | Applies to | Lesson |
|---|---|---|
| Commissions and fees | Every trade | Commissions and Fees |
| Bid ask spread | Market orders and aggressive limit orders | Spread Costs |
| Slippage | Difference between expected and actual fill price | Slippage |
| Market impact | Larger orders moving the price | Market Impact |
| Financing and swap costs | Leveraged and overnight positions | Financing and Overnight Costs |
| Borrow fees | Short selling stocks | Borrow Fees and Stock Loan Costs |
| Futures roll costs | Rolling contracts | Roll Costs |
| Funding rates | Crypto perpetual futures | Funding Rates |
| Taxes | Depends on jurisdiction | Trading Taxes and Capital Gains |
How costs scale with trading frequency#
Estimating slippage#
| Approach | Description |
|---|---|
| Fixed per trade | A set number of ticks or basis points; simple |
| Spread based | Half the typical spread per side, plus a buffer |
| Volatility based | Slippage proportional to recent volatility |
| Volume based (market impact models) | Larger relative to average volume means larger cost |
| Live data | Measure actual fills versus signal prices. See Slippage Analysis |
A common square root market impact model:
impact ≈ k × σ × √(order size / average daily volume)
where σ is daily volatility and k a constant often estimated around 0.5 to 1. See Market Impact.
Conservative rules of thumb#
- Assume you cross the spread for market orders and many stops.
- Add extra slippage around open, close and news, when spreads widen.
- Do not assume limit orders always fill: filled limit orders are often the ones the market moved through against you. See Fill Models, Partial Fills and Order Queues.
- Scale costs with volatility and size.
- Run sensitivity tests at 1.5 times and 2 times your cost estimate. See Robustness and Stress Testing.
- Include financing for every night positions are held.
- Use realistic borrow costs and availability for shorts; some stocks cannot be borrowed.
Costs differ by market#
| Market | Typical cost features |
|---|---|
| Large cap stocks | Tight spreads; impact matters for large orders |
| Small cap stocks | Wide spreads; high impact |
| Futures | Commissions per contract plus one tick spread in liquid contracts |
| Forex | Spread based; widens in thin hours |
| Options | Wide spreads relative to price; often the dominant cost |
| Crypto | Maker and taker fees; funding; spreads vary by venue |
| Prediction markets | Spread and fees; thin books in small markets |
Validate with live trading#
After launching, compare actual costs with backtest assumptions. Implementation shortfall, the difference between the price when the decision was made and the final execution price, is the standard measure. See Implementation Shortfall.
Frequently asked questions#
Why are trading costs important in backtests?#
Because commissions, spreads, slippage and financing reduce returns, and they can eliminate the edge of strategies that trade often or target small moves.
How should I estimate slippage?#
Start with half the spread per side plus a buffer, scale with volatility and order size, and refine using actual live fills.
What is a conservative cost assumption?#
Assume you cross the spread, add slippage in volatile periods, include all financing and borrow costs and test at higher cost levels.
Next, learn a fast way to backtest in Event-Driven vs Vectorized Backtesting.
3 quick questions on this lesson. Get them all right to finish it.
Turn on JavaScript to take the quiz.
Mentioned in
- The Trading Research ProcessResearch and Backtesting
- Why Strategies FailResearch and Backtesting
- Backtesting MethodologyResearch and Backtesting
- Robustness and Stress TestingResearch and Backtesting
- Portfolio and Multi-Asset BacktestingResearch and Backtesting
- Signal and Alpha DecayResearch and Backtesting