What is slippage in trading bots? (causes, cost and how to cut it)

Slippage is the gap between the price your bot expected and the price it actually got — and it's the silent killer of strategies that looked great in a backtest. A signal says buy at $100; by the time your market order fills, you paid $100.15. That 0.15% sounds tiny, but on a bot that trades hundreds of times it can erase the entire edge. This guide explains where slippage comes from, why it punishes fast strategies hardest, how to model it honestly in a backtest, and how to reduce it.

On this page
  1. What slippage is
  2. Where it comes from
  3. Market vs limit
  4. Modelling it honestly
  5. How to reduce it
  6. The bottom line
  7. FAQ

What slippage is

Slippage is the difference between the expected execution price and the actual filled price. It can be negative (you got a worse price) or, occasionally, positive (better). For a bot it matters because it's a real, recurring cost on top of fees — and unlike fees, it's variable and easy to forget when you're admiring a backtest that assumed perfect fills.

Where slippage comes from

$100.00 · small size $100.10 $100.25 best ask large market order walks up the book → avg fill > $100
A market order bigger than the top of the book fills through worse levels — that's slippage.

Market vs limit orders

The fundamental trade-off

A market order guarantees a fill but not a price — it accepts whatever slippage the book imposes. A limit order guarantees a price but not a fill — it may never execute if price runs away. Bots that need certainty of execution (stop-outs, momentum entries) lean market; bots that can be patient (mean reversion, market making) lean limit and can even earn the spread instead of paying it.

Modelling slippage honestly in a backtest

A backtest that fills every order at the exact signal price is lying to you, and the lie is largest for high-frequency strategies. The fix is to subtract a slippage estimate from every fill — a fixed number of basis points, or better, a model scaled by your order size relative to recent volume. A strategy that's profitable at 0 bps and dead at 10 bps was never real. This is exactly why honest backtesting insists on modelling costs.

python · slippage.pydef apply_slippage(price, side, bps=5):
    slip = price * bps/10000          # 5 bps = 0.05%
    return price + slip if side == 'buy' else price - slip

fill = apply_slippage(signal_price, 'buy', bps=8)   # pay up to buy

How to reduce slippage

The bottom line

Slippage is why scalping and HFT-style retail strategies usually fail: their tiny edge per trade can't survive the cost of crossing the spread hundreds of times. Slower strategies pay it far less. Always model slippage in the backtester (it includes a fee/slippage input), confirm the strategy still works after costs, and prove it in paper trading where real fills reveal the true number.

Not financial advice. This content is educational. Automated and algorithmic trading carries a real risk of financial loss. Never trade money you cannot afford to lose. Review the SEC investor.gov and CFTC resources before trading.

Frequently asked questions

What is slippage in trading bots?

Slippage is the difference between the price a bot expected and the price it actually filled at. A buy signalled at $100 might fill at $100.15 because the market moved or the order was larger than the best available price. It is a real, recurring cost on top of fees.

What causes slippage?

Slippage comes from thin liquidity (an order larger than the size at the best price walks into worse levels), volatility and latency (price moves between decision and fill), and wide bid-ask spreads in illiquid markets or off-hours sessions.

How do market and limit orders affect slippage?

A market order guarantees a fill but accepts whatever slippage the order book imposes; a limit order guarantees a price but may never fill if price runs away. Patient strategies use limit orders to avoid or even earn the spread, while strategies needing certain execution use market orders.

How do you model slippage in a backtest?

Subtract a slippage estimate from every fill — a fixed number of basis points, or a model scaled by order size relative to recent volume. A backtest that fills at the exact signal price overstates returns, especially for high-frequency strategies, so always test whether the edge survives realistic costs.

MB

Mustafa Bilgic

Algorithmic trading practitioner · Founder, AITradingBot.us

Mustafa builds and backtests automated trading systems and writes about them without the hype. Every tool on this site is free and runs entirely in your browser.