Need help: I want to compare RSI of different equities. The log returns 0.0 on the following- not getting RSI correctly. I have read through hundreds of scripts and cannot find a solution. Any help appreciated.


 

from clr import AddReference AddReference("System") AddReference("QuantConnect.Algorithm") AddReference("QuantConnect.Indicators") AddReference("QuantConnect.Common") from System import * from QuantConnect import * from QuantConnect.Algorithm import * from QuantConnect.Indicators import * from QuantConnect.Parameters import * class DynamicUncoupledPrism(QCAlgorithm): def Initialize(self): self.SetStartDate(2020, 10, 7) #Set Start Date self.SetEndDate(2020, 10, 11) #Set End Date self.SetCash(100000) #Set Strategy Cash self.AddEquity("MSFT", Resolution.Minute) self.MSFTrsi = RelativeStrengthIndex("MSFT", 6) self.MSFTrsiWindow = RollingWindow[float](5) self.AddEquity("APPL", Resolution.Minute) self.APPLrsi = RelativeStrengthIndex("APPL", 6) self.APPLrsiWindow = RollingWindow[float](5) self.AddEquity("AMZN", Resolution.Minute) self.AMZNrsi = RelativeStrengthIndex("AMZN", 6) self.AMZNrsiWindow = RollingWindow[float](5) self.AddEquity("TSLA", Resolution.Minute) self.TSLArsi = RelativeStrengthIndex("TSLA", 6) self.TSLArsiWindow = RollingWindow[float](5) def OnData(self, data): '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.''' self.MSFTrsiWindow.Add(self.MSFTrsi.Current.Value) self.APPLrsiWindow.Add(self.APPLrsi.Current.Value) self.AMZNrsiWindow.Add(self.AMZNrsi.Current.Value) self.TSLArsiWindow.Add(self.TSLArsi.Current.Value) # wait for our indicators to ready if not self.MSFTrsi.IsReady or not self.APPLrsi.IsReady or not self.AMZNrsi.IsReady or not self.TSLArsi.IsReady: return self.Log(f"MSFTrsi: {RelativeStrengthIndex('MSFT', 6)}")