Back

Window indicator with multiple outputs

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

Update Backtest







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.

0


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.


 
0


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.
0

Instead of using "self.RSI("IBM", 14, resolution=Resolution.Daily).Updated += self.RsiUpdated", please update the rolling window in OnData() with the RSI object.

1

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.


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.

0

I'm not able to print all the values in the window.

0


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.

0

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.


Update Backtest





0

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.


Loading...

This discussion is closed