Hello,
Im trying to calculate the HullMovingAverage of the RSI, but im getting an error;
self.rsi = self.RSI(self.symbol, 60, Resolution.Minute)
hull_ma = HullMovingAverage(120)
self.hulrsi = IndicatorExtensions.Of(hull_ma, self.RSI)
what am I doing wrong??
ERROR:
During the algorithm initialization, the following exception has occurred: InvalidCastException : cannot convert object to target type ---> Python.Runtime.PythonException: TypeError : value cannot be converted to Type === --- End of inner exception stack trace --- at Python.Runtime.PyObject.AsManagedObject(Type t) at QuantConnect.Extensions.SafeAsManagedObject(PyObject pyObject, Type typeToConvertTo) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Common/Extensions.cs:line 2621 at QuantConnect.Indicators.IndicatorExtensions.Of(PyObject second, PyObject first, Boolean waitForFirstToReady) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Indicators/IndicatorExtensions.cs:line 343 at Initialize self.hulrsi = IndicatorExtensions.Of(hull_ma in main.py: line 54 InvalidCastException : cannot convert object to target type ---> Python.Runtime.PythonException: TypeError : value cannot be converted to Type
Álvaro Anton Blanco
Found this on the community
The syntax is super strange, but it does the job;
self.rsi = self.RSI(self.symbol, 60, Resolution.Minute)
self.hulrsi = IndicatorExtensions.Of(self.HMA(self.symbol,120,Resolution.Minute), self.rsi)
Mak K
Hi Álvaro,
Another way of doing this would be ;
This will create a linear weighted moving average for RSI. Here is documentation on how to find indicator names and how to use them;
https://www.quantconnect.com/docs/algorithm-reference/indicators#:~:text=Daily%2C%20Field.High)-,Reference%20Table,-Indicators
Let me know if you have any questions regarding this, thanks!
Vladimir
Álvaro Anton Blanco
It is very important to set the warm-up period correctly.
Try this.
Vladimir
Álvaro Anton Blanco
Here is the "HULL RSI Indicator" you mentioned here.
Álvaro Anton Blanco
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!