Hello,
I added a window rsi indicator:
self.RSI(self.symbol, 14, resolution=resolution).Updated += self.RsiUpdated
self.rsiWin = RollingWindow[RelativeStrengthIndex](3)
def RsiUpdated(self, sender, updated):
'''Adds updated values to rolling window'''
self.rsiWin.Add(updated)
Now, according to the documentation, this indicator has 3 outputs: RSI, AverageLoss, AverageGain.
However, I'm only able to get the RSI value with:
self.rsiWin[0].Value
Is there a way to get the other two output values? The same problem stands for other indicators with multiple outputs like MACD or Ichimoku.
Thanks
Daniele
Gurumeher Sawhney
In this scenario, self.rsiWin[0] will return the most recent RelativeStrengthIndex object. The RelativeStrengthIndex object has the two properties AverageLoss and Average Gain. The algorithm below is a simplified version of the above problem and AverageLoss can be accessed via the command
self.rsi.AverageLoss
with self.rsi being the RSI indicator.
DanieleC87
Hello Gurumeher,
in your example you are using a simple indicator and not a window indicator.
In the case of a window indicator I get an error when the indicator is updated.
DanieleC87
I forgot to say that I try two ways to initialize the window:
self.rsiWin = RollingWindow[RelativeStrengthIndex](3)
self.rsiWin = RollingWindow[IndicatorDataPoint](3)
In the first case, I would get the entire object but I get the error on the
RsiUpdated function. In the second case, I get an IndicatorDataPoint which gives me only the Value field which contains only the RSI, but I can't get the other values. I attach also this case.Jing Wu
Instead of using "self.RSI("IBM", 14, resolution=Resolution.Daily).Updated += self.RsiUpdated", please update the rolling window in OnData() with the RSI object.
DanieleC87
I'm trying now to print the values of AverageLoss for the window, but I get the same value for every element of the window.
DanieleC87
I'm not able to print all the values in the window.
Jing Wu
Hi Daniele,
I found the same issue with RollingWindow[RelativeStrengthIndex](3) because the indicator object self.rsi will be updated and the instance value will change as well. You should create more than 1 rolling window to save different rsi values.
DanieleC87
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!