On the importance of Slippage (Please read this)

I've began coding an algorithm 3 months ago. I had never coded a Quant algo before. After hours of work I was thinking that i've got one of the best algo out there. Check out those results!

After testing it live with IB Paper and QuantConnect data (I had to put money to open an IB account), I have realized that some orders had a great ammount of slippage and were not the same as my backtests. So I decided to put a slippage model. Nothing extravagant only 0.0002m. And now, I have just realized that my algo is just a worthless buy at invalid price thing.

So please don't do the same mistake. Slippage model should be the first lines of code you write in your algos.

Update Backtest

thanks for sharing this information. seems the amount of orders destroyed it in long term?


Could you yell us about your setup? Were fees and other broker realism items included in the first backtest? Are you working with liquid assets? How long on average are positions held and are they traded around volatile times such as immediate open/close?

If you search for slippage on the forums you can find some gems left by Jared of QC:


Yes slippage and commission and cost related to short will kill most algorithms out there. Many people know about it but they will still set it all to 0 so "They can better understand the Alpha" I find it a waste of time. I normally set a over pessimistic slippage and comission.


Just to mention that the slippage model is 0.002m not 0.0002m.

Michael Manus : Yes to much orders did destroy it. I've managed to take less orders sacrifying pofit and it became profitable, (Not as much as before and with higher drawdowns.)

Derek Tishler : I'm using the InteractiveBrokersBrokerage BrokerageModel for fees. Asset is really liquid (XIV). The problem was really the amount of orders within a short amount of time.

Lucas Silva  : I actually did not think about that. It's my first algo.


I've found that going with Daily resolution results in faster backtests with less slippage problems.


Update Backtest


The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


This discussion is closed