Hi, I cant seem to understand why i'm having this error. Self.r is defined under OnData, which is when data is available. But for some reason, the algo requires the information in hand to run it? Can someone help please
QUANTCONNECT COMMUNITY
Hi, I cant seem to understand why i'm having this error. Self.r is defined under OnData, which is when data is available. But for some reason, the algo requires the information in hand to run it? Can someone help please
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.
Yusuf Salleh
Yusuf Salleh
Nico Xenox
Hey Yusuf Salleh,
thank you for providing the code. The problem is here that you try to use self.r before you even calculated it. This means that we will first have to check if self.r even has a value before using it:
I attached the working backtest.
Hope it helps ;)
Yusuf Salleh
Perfect! Nico Xenox  Thank you so much. i knew it was this simple :) Appreciate it.Â
Nico Xenox
Thank you for letting me know that my response was helpful to you. If you're satisfied with my answer, would you mind accepting it?Â
This would help indicate to others that the question has been resolved. Thank you 😊
Yusuf Salleh
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!