why is this code not taking any trades when backtesting?
QUANTCONNECT COMMUNITY
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.
Mia Alissi
Based on the provided code, it seems that the algorithm is not placing any trades because the
EnterTrade
method, which presumably would be responsible for placing trades, is not defined anywhere in the code. This means that even if the conditions for a trade are met in theCheckTrade
method, there is no code to actually execute the trade.Additionally, the
DetectEqualHighsLows
method is not returning any values. This method is supposed to returneqh
andeql
, but there are no return statements in the method. This could potentially cause issues aseqh
andeql
are used in theCheckTrade
method.Please note that without the complete code or a more specific error message, it's hard to provide a more precise answer. It would be helpful to see the complete algorithm, including the
EnterTrade
method and any error messages you're receiving during backtesting.You can also refer to the QuantConnect Algorithm Reference for more information on how to structure your algorithm and place trades.
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.
Conrad Krol
I tried all of this and it still won't enter any trades? why won't it place any entries?
Mia Alissi
Based on the provided code, it seems that the algorithm is not placing any trades because the
EnterTrade
method, which presumably would be responsible for placing trades, is not defined anywhere in the code. This means that even if the conditions for a trade are met in theCheckTrade
method, there is no code to actually execute the trade.Additionally, the
DetectEqualHighsLows
method is not returning any values. This method is supposed to returneqh
andeql
, but there are no return statements in the method. This could potentially cause issues aseqh
andeql
are used in theCheckTrade
method.Please note that without the complete code or a more specific error message, it's hard to provide a more precise answer. It would be helpful to see the complete algorithm, including the
EnterTrade
method and any error messages you're receiving during backtesting.You can also refer to the QuantConnect Algorithm Reference for more information on how to structure your algorithm and place trades.
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.
Conrad Krol
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!