Hello,
I am using a custom class to store indicators for every equity in my universe. I am trying to create a 6 day RSI with an exponential average type. I have created the consolidator separately so that it can be unsubscribed if the equity leaves the universe. I tested in another algorithm using the self.RSI() constructor to create a 6 day exponential RSI, and it returned a different value at a specific time than my code below. Have I made a mistake in the way I created this? The universe's resolution is Second by the way.
self.symbolRSI = RelativeStrengthIndex(6, MovingAverageType.Exponential)
self.consolidatorRSI = TradeBarConsolidator(Resolution.Daily)
algo.RegisterIndicator(self.symbol, self.symbolRSI, self.consolidatorRSI)
# history request to fill in past 6 days of data
historyRSI = algo.History(self.symbol, 6, Resolution.Daily)
if not historyRSI.empty:
for time, row in historyRSI.loc[symbol].iterrows():
self.symbolRSI.Update(time, row['close'])
Matthew Kobrick
Changing from Resolution.Daily to timedelta(days = 1) fixed it if anyone else has a similar issue.
Alexandre Catarino
Hi Matthew Kobrick ,
Sorry about the wait.
The TradeBarConsolidator constructor doesn't accept Resolution as an argument. However, since the Resolution enum is mapped to an integer, it will accept it without a runtime error. The value of Resolution.Daily is 4. Consequently:
Using a timedelta object as an argument, like you did, solves the issue.
Matthew Kobrick
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!