Hi, I am new to python and Quantconnect. I got soem questions in my development project.
First, I wonder whether we can divide two equities in directly in Initializer.
Second, it is possible to calculate the SMA of the ratio by using self.SMA(self.ratio, .....)
Thank you. Below is the code
class SMATrendAlgo(QCAlgorithm):
def Initialize(self):
self.period = 20
self.SetStartDate(2010, 01, 01) #Set Start Date
self.SetEndDate(2015, 01, 01) #Set End Date
self.SetCash(100000) #Set Strategy Cash
self.spy = self.AddEquity("SPY", Resolution.Daily).value
self.tlt = self.AddEquity("TLT", Resolution.Daily).value
self.ratio = self.spy/self.tlt
self.sma20 = self.SMA(self.ratio, 20, Resolution.Daily)