Does anyone have an understanding of why some of the backtests randomly stop before reaching the end date? I ran a backtest from January 2020 to January 2023 but the algorithm stops at March 2020. Any insight or explanation around this or if I am doing something to cause this?
Mia Alissi
There could be several reasons why your backtest is stopping before reaching the end date. Here are some potential causes based on the information provided in the extracts:
Errors in the Algorithm: If there are any unhandled exceptions or errors in your algorithm, it could cause the backtest to stop prematurely. For example, if you are trading options or futures and the security is not in the portfolio anymore, that could throw an error and stop the backtest (source).
Memory Limitations: If your algorithm uses a lot of memory, it could hit the maximum memory limit and cause the backtest to stop. For example, one user reported their backtest stopping due to max memory usage (source).
Maximum Number of Orders: There seems to be a limit on the maximum number of orders per backtest. If your algorithm places a large number of orders, it could hit this limit and cause the backtest to stop (source).
Long Running Code: If your algorithm has a loop or a block of code that runs for more than 10 minutes, the backtest will stop (source).
Data Differences: If you're running the backtest on your local machine, differences in data between your local machine and the QuantConnect Cloud could cause different backtest results (source).
To debug the issue, you could add more logging to your algorithm to understand what's happening right before the backtest stops. If the issue persists, you might want to share your algorithm and create a support ticket for further assistance.
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.
Akira
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!