Hi everyone,
While experimenting with futures, I noticed that the Future Fill Model seems to produce unusually high slippage on stop market orders. According to the documentation (docs), the fill price is set to either the stop price or the close price of the next bar, plus the slippage. This often leads to much higher fill prices than I expected. Also I'm wondering, why the slippage is only applied to the already worse close price, and not to the stop price.
In comparison, the Equity Model uses a formula based on max(open price, stop price) + slippage, which seems more intuitive to me. If the candle gaps, the open price is used; otherwise, the stop price is used (docs).
Based on my experience with QuantConnect, I do not think this a bug but perhaps a misunderstanding on my part. Is this model for stop market order fills common practice in futures trading? Or is there a rationale behind this difference between the Futures and Equity models that I’m missing?
Thanks
Mia Alissi
Here's a detailed and friendly explanation you can share with 'Loki' regarding the rationale and industry practice behind the difference in stop market order fill models between QuantConnect's Future and Equity FillModels:
Hi Loki,
Great question—this is a point of confusion for many users transitioning between equities and futures on QuantConnect or other trading/backtesting platforms!
Why does the FutureFillModel fill stop market orders at close + slippage rather than max(open, stop) + slippage?
According to QuantConnect’s documentation, the FutureFillModel, after the stop is triggered, fills stop market orders “at the close price (of the same bar or next bar depending on data), plus slippage (docs).” This is different from the EquityFillModel, which fills at max(open price, stop price) + slippage (docs).
The rationale for this difference is two-fold:
Conservative/Pessimistic Simulation:
Market Microstructure Differences:
Why add slippage to the close price rather than to the stop price?
Adding slippage to the (already worse) close price is a way to further pessimistically simulate real market conditions:
Is this "industry standard"?
What if this is too pessimistic for your style?
You can subclass and customize the fill model for your futures security. For example, you could override the stop_market_fill method to use the max(open, stop) + slippage logic—just as in the equity model—if you believe it reflects your live expectations better.
If you want example code for how to do this customization, let me know!
Summary Table: (from the docs)
Model Fill Formula for Stops on Bars Rationale Futures max(stop, close) + slippage Pessimistic, simulates poor fill Equities max(open, stop) + slippage Avoids gap-to-unfillable priceHopefully, this clears up the rationale and helps you decide if you want to customize the behavior for your use case. If you want code for a custom fill model or more links from the docs, just ask!
Let me know if you’d like to see an example for a custom futures fill model with equity-style stop fills.
Sources: Equity Model - QuantConnect.com, Future Option Model - QuantConnect.com, Future Model - QuantConnect.com, Custom Models Algorithm, Forward Data Only Fill Model Algorithm
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.
Loki Lokus
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!