Trading costs
What each trade costs on top of the price: commissions, and slippage from not getting quite the price you saw.
3 min readLesson 28 of 57Interactive
In short
Small costs add up fast for strategies that trade often. A backtest without them flatters any strategy that buys and sells a lot.
Why it matters
Every trade loses a little to costs. One trade's costs are small enough to ignore. A strategy that trades every week repeats them dozens of times a year, and they come straight out of the return.
That's why trading costs matter most when testing a strategy. A backtest that ignores them can make a strategy that trades often look better than buying and holding, when after costs it does worse. Adding even modest costs is one of the quickest honesty checks there is.
How it works
There are two main kinds. A commission is a fee the broker charges per trade. Slippage is the gap between the price you expected and the one you got: crossing the spread between bid and ask, the price moving while your order fills, or a large order pushing the price.
MarketLab's backtester lets you set both. The commission is a fixed number of dollars per trade. Slippage is in basis points (bps), hundredths of a percent: 10 bps is 0.1%. A buy fills that much above the day's close, and a sell that much below it.
Costs are paid on every leg. Getting into a position and back out again is two trades, so a round trip pays the commission twice and the slippage twice. What matters is turnover: how much of the portfolio is bought and sold over a year. A strategy that swaps its whole portfolio every month pays about twelve times as much as one that trades once a year.
The simulated trading account doesn't charge costs: trades fill at the close as shown. Real brokers differ, so the backtest is where you see their effect.
buy price = close × (1 + bps ÷ 10,000); sell price = close × (1 − bps ÷ 10,000); plus the commission on each trade
Slippage makes each fill slightly worse than the close, and every trade also pays the fixed commission.
A worked example
A backtest starts with $10,000, a $1 commission and 5 bps of slippage. One strategy trades its whole account 50 times a year; another buys once and holds.
- Slippage on one trade: 5 bps = 0.05%, so 0.05% × $10,000 = $5.00. A buy at a $100.00 close fills at $100.00 × 1.0005 = $100.05.
- Cost per trade: $5.00 slippage + $1.00 commission = $6.00.
- The active strategy: 50 × $6.00 = $300.00 a year, or 3% of $10,000.
- Buy and hold: one trade, $6.00 in total, or 0.06%.
Result: The same small costs take about 3% a year from the active strategy and almost nothing from buy and hold. The active one needs to beat the market by more than 3% a year just to break even with it.
Try it
What trading costs add up to
Without costs
$14,693
After costs
$11,174
Lost to costs
$3,520
24.0% of the result
$10,000 earning 8% a year before costs, for 5 years.
How to read it
- 0 to 5 bps of slippage
- Close to reality for large, busy stocks traded in modest amounts.
- 10 to 30 bps
- A cautious setting: smaller stocks, larger orders, or a test of how robust a strategy is.
- A strategy that only wins with zero costs
- A warning sign: its edge is probably smaller than real-world friction.
- Results barely change with costs
- It trades rarely, so costs aren't what decides whether it works.
In the real world
- Most US brokers dropped commissions on stock trades to $0 around 2019. Spreads and slippage didn't go away, so active traders still pay something on every trade.
- Fund managers track costs closely, because over years they compound just like returns do. Index funds keep costs low partly by trading rarely. See Compounding.
- Taxes are another cost of trading often: in many countries, selling at a gain in a regular account can create a tax bill, while holding defers it. MarketLab doesn't model taxes.
Common mistakes
- Running backtests with costs set to zero and trusting the result for a strategy that trades often.
- Assuming $0 commission means free. The spread is still paid on every round trip.
- Forgetting that costs scale with turnover. Ten times the trading means roughly ten times the costs.
See it in MarketLab
Test yourself
Optional: 4 quick questions on the words, using the idea, and how it plays out in real markets.
Loading your answers…