Slippage Model
Slippage models the difference between expected and actual fill prices.
Default Model
The engine uses a percentage-based slippage model:
Fill Price = Open × (1 + slippage × direction)
| Direction | Calculation | Effect |
|---|---|---|
| Buy (+1) | Open × (1 + slippage) | Pay more |
| Sell (-1) | Open × (1 - slippage) | Receive less |
Configuration
Slippage is set in the backtest configuration:
// Backtest settings { slippage: 0.001, // 0.1% slippage // or slippage: 0.005, // 0.5% for less liquid markets }
Examples
With slippage = 0.001 (0.1%):
| Order | Open Price | Fill Price |
|---|---|---|
| Buy 1 | 100.00 | 100.10 |
| Sell 1 | 100.00 | 99.90 |
Why Slippage Matters
A strategy that looks profitable without slippage often fails with realistic slippage:
No slippage: +15% return 0.1% slippage: +8% return 0.5% slippage: -2% return (unprofitable!)
Best Practices
Always test with slippage
Never evaluate a strategy at 0% slippage. Use realistic values:
| Market | Suggested Slippage |
|---|---|
| BTC/USDT | 0.05% - 0.1% |
| Major alts | 0.1% - 0.2% |
| Small alts | 0.3% - 0.5% |
| Low liquidity | 0.5% - 1.0% |
Sensitivity testing
Test your strategy at multiple slippage levels:
Run 1: slippage = 0.05% Run 2: slippage = 0.1% Run 3: slippage = 0.2%
If profitability disappears at higher slippage, the strategy may not be robust.
Related
enginefillsslippagerealisticqsl