Slippage is the gap between the price you expected and the price you actually got. It comes from the spread (gap between best bid and best ask), the depth of the order book and price movement during execution.
Example: you buy 600 shares at market, mid price 100.00. The book fills you 200 at 100.02, 300 at 100.03 and 100 at 100.05: average price 100.03, i.e. 0.03% slippage. The bigger the order relative to the book, the more it slips.
Slippage explodes on stops (executed at market when everyone is selling), at the open, around announcements and on illiquid stocks. A stop at 95 can exit at 92 after an opening gap.
In a backtest, subtract a prudent slippage on every entry and exit (for example 1 to 2 ticks, more for stops). Calculation: gross edge 0.30% per trade, slippage 0.10% per side: 0.30 − 2 × 0.10 = 0.10% is left. An edge smaller than slippage does not exist live.
Examples
SLIP-X (fictional market) : On this fictional market, the gap between buyers and sellers widens at times. A market order placed at those moments pays the whole gap, and more if it is large: that is the cost a backtest at a "perfect" price forgets.
6 May 2010: the flash crash : On 6 May 2010, US indices plunged within minutes before rebounding almost immediately. Stop orders turned into market orders in an empty book: Accenture shares traded at 1 cent. The authorities cancelled some of the most aberrant trades, but not all: a stop's slippage can be immense.
Key terms
Slippage
Gap between the expected price and the price obtained
Spread
Gap between the best ask and the best bid
Depth
Quantities available at each price in the order book
Market order
Order executed immediately at the best available price, whatever it is