I am getting this error on backtest:
Trying to dynamically access a method that does not exist throws a TypeError exception. To prevent the exception, ensure each parameter type matches those required by the 'float'>) method. Please checkout the API documentation.
at OnData
self.high_window.Add(self, bar.High)
in main.py: line 23
Mia Alissi
The error message you're seeing is typically thrown when you're trying to call a method that doesn't exist or when the arguments you're passing to a method don't match the method's required parameters.
In your case, the error is occurring on this line of code:
The
Add
method of a RollingWindow object in QuantConnect only takes one argument, which is the data you want to add to the window. However, you're passing two arguments:self
andbar.High
.If
self.high_window
is a RollingWindow object andbar.High
is the data you want to add to the window, you should change the line to:This will add the high price of the bar to the rolling window.
Please refer to the QuantConnect documentation for more information on how to use RollingWindow objects.
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.
Shiven Garg
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!