Glossary

What is slippage in trading?

Slippage is the difference between the price a strategy expected for an order and the price at which the order was actually filled.

It is common in fast markets and when few orders sit near the current price. A market order takes the best price first; if the volume there runs out, the rest fills at worse prices. A stop order becomes a market order once its price is reached, so in a fast move a stop loss can fill beyond its level.

Pine Script's slippage setting is 0 by default and counts ticks, the smallest price step of a market, so check what your setting means in money: with a very small tick size, 2 ticks are close to nothing. To measure real slippage, compare each live fill with the price your strategy expected.

In practice

In our 10 rules for an honest backtest, a fee of 0.1% per order plus 0.05% slippage per fill makes a round trip cost 0.30%: over 100 trades with an average gross gain of 0.40%, costs remove 30 of the 40 percentage points (round example numbers, simple sums).

Illustrative numbers from the post, not a backtest result.

Read more

Topic: Trading costs

Part of the guide: Pine Script backtesting

Sources