I'm working on a strategy that calculates the RSI of closing prices of ETFs.   I am going to use the (extensive!) indicators library to my make work a little simpler.   For example, in the code snippet below, I can get the RSI of the close price of SPY.

One question I have is, how do I include the current price into the calculation being done in the indicator?  If I understand the docs correctly, the 3-period RSI calculation being done below only includes data for T-3, T-2, and T-1  (T being today).   As I am estimating the close and am executing right before it, I would like my RSI calculation to include data for T, T-1 and T-2. 

Basically, my question is:
Is there an easy way to get indicators to include the current price data along with historical data in daily algorithms that execute at the close?
 

from QuantConnect import * from QuantConnect.Algorithm import * from QuantConnect.Indicators import * class Strategy(QCAlgorithm): self.SetCash(100000) self.SetStartDate(2017, 12, 1) self.SetEndDate(2017, 12, 20) self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Margin) self.etfs = ['SPY'] self.rsi_data = {} for etf in self.etfs: self.AddEquity(etf, Resolution.Daily) self.Securities[etf].FeeModel = ConstantFeeTransactionModel(0) self.Securities[etf].SlippageModel = ConstantSlippageModel(0) #add indicators here self.rsi_data[etf] = self.RSI(etf, 3) self.Schedule.On(self.DateRules.EveryDay('SPY'), self.TimeRules.BeforeMarketClose('SPY', 1), Action(self.Rebalance)) def OnData(self, slice): pass def Rebalance(self): for etf in self.etfs: if self.rsi_data[etf].IsReady: self.Log(str(self.rsi_data[etf]))

Author