This article was written by @bunie
- Let’s talk about Slippage: Here you will see 2 equity curves. Both of these are from the exact same strategy, with the exact same settings, with only 1 difference… One of these equity curves (the prettier one) has no slippage applied. The other (the not so nice one with over 100% drawdown) does have some slippage applied… ouch! So… what is slippage and why do we need to add it when backtesting? The markets are volatile, when Tradingview triggers a trade during a moving market, three things come into play —
- It takes time for Tradingview to contact the exchange, and for the exchange to execute that order. In that time the price can move up or down, especially in times of high volatility.
- When you execute a market order you have to pay the spread between the buyers and sellers for immediate execution (For more info: https://www.ledger.com/academy/glossary/bid-ask-spread). This means you’re paying a little more than the price on tradingview, depending on the spread.
- Finally, liquidity (Info here: https://cointelegraph.com/explained/crypto-exchange-liquidity-and-why-it-matters-explained). The less liquidity there is in the market the faster it will move. And, the larger your order is, the more it will impact that movement. Some exchanges have lower liquidity than others.
- So…. uh… how do I calculate Slippage? It’s hard…. it’s ####ing hard!…
- As a starting point…. try the Slippage Calculator indicator by zuklesny set to 1 minute and try to find a roughly average slippage amount. This is just to start, and it’s impossible for this to be accurate, but at least you’ve accounted for some slippage and you’re not fooling yourself with those sexy curves.
- Start manually recording your trades by coin & exchange — what price did tradingview execute at? What price did the exchange execute at? What’s the difference?
- Record a lot of these… until you can build a picture of average slippage for a coin/exhange over time.
- Final note: If you can get a strategy working well with slippage, you are likely onto a winner. Provided you haven’t over-fitted, you’ve remembererd to also add comission and you’ve incubated it before putting it live to see how it performs.