Preloader

Slippage

This article was written by @bunie

  1. 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 —
    1. 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.
    2. 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.
    3. 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 what..? Well… all of this leads to your trade not executing at the price tradingview tells you. Your equity curve will look great on paper, but your account balance might not look so great when the bot goes live.ImageImageImageImage
  2. So…. uh… how do I calculate Slippage? It’s hard…. it’s ####ing hard!…
    1. 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.
    2. 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?
    3. Record a lot of these… until you can build a picture of average slippage for a coin/exhange over time.
    Why are some of my examples green on that spreadsheet? Well… there’s positive slippage where you actually execute at a better price, and negative, where you execute at a less favourable price. Unless you have recorded a lot of trades to average over, stick to averaging the negatives (i.e. the worst case)
  3. 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.
bitcoin
Bitcoin (BTC) $ 67,201.01 0.13%
tether
Tether (USDT) $ 0.9999 0.03%
ethereum
Ethereum (ETH) $ 3,106.58 0.50%
solana
Solana (SOL) $ 178.48 4.05%
bnb
BNB (BNB) $ 574.17 0.83%
xrp
XRP (XRP) $ 0.512263 0.97%
dogecoin
Dogecoin (DOGE) $ 0.152081 0.29%
cardano
Cardano (ADA) $ 0.468947 1.31%
avalanche-2
Avalanche (AVAX) $ 36.25 0.70%
chainlink
Chainlink (LINK) $ 16.68 0.99%
Trusted Site