What is the benefit of using a continuous futures contract for backtesting? Can I also use it during live trading whenever I connect QC with Interactive Broker?
I am asking this because I was having a hard time using rollover futures contracts.
Basically, I am unable to get accurate bar data in on_data when I use the contracts that can expire.
Mia Alissi
Benefits of Using Continuous Futures for Backtesting
Continuous Price Series: Continuous futures contracts offer a seamless price series by automatically rolling over expiring contracts. This feature smooths the price series for identifying long-term trends without interruptions from contract expirations.
Historical Analysis Consistency: Continuous contracts adjust historical prices based on the entirety of available data, ensuring consistency regardless of the backtest end date. This mechanism makes it easier to compare performance across different testing periods.
Reduced Complexity: By managing the complexities of multiple contract rollovers internally, continuous contracts simplify strategy development and analysis, allowing you to focus on broader strategy testing.
Using Continuous Futures in Live Trading with Interactive Brokers
Informative for Live Strategies: While continuous contracts are mainly for backtesting, they can help inform live trading strategies by simulating automatic rollover based on features like open interest. This way, continuous contracts can guide which specific contracts you should trade using Interactive Brokers in a live environment.
Strategy Development: Insights gained from continuous futures during backtests can be used to inform live strategy choices, thus ensuring smooth transitions across contract expirations.
Handling Expiring Contracts and Accurate Bar Data Using
Data Integrity: Ensure the integrity of bar data by checking if the
Slice
object received inon_data
contains data for your contract before proceeding with trading decisions.SymbolChange Handling: Implement logic to respond to
SymbolChangedEvent
, which will enable your strategy to adapt smoothly between contract rollovers, thus maintaining accurate data during such transitions.Continuous Contracts in Backtesting: QuantConnect allows backtesting with continuous futures through an interface (
IContinuousContractModel
) that models continuous price data effectively. This is useful for backtests without the concern of adjusting to new contracts manually.Utilizing continuous futures significantly enhances backtesting by handling contract expiry internally, delivering a consistent and detailed historical analysis, and assisting in the transition of strategies to live environments with minimal friction regarding contract changes.
Sources: International Futures - QuantConnect.com, US Futures - QuantConnect.com, Futures - QuantConnect.com, Futures - QuantConnect.com, US Futures Security Master - QuantConnect.com
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.
QuantHeart
The bar data from the consolidator receiver and the bar data from on_data don't match, even though I am using the same future contract.
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!