I am trying to use Parabolic SAR on the e-mini SPX. I have seen the example here when using it on forex:
I'm using the Futures Template and this is what my code looks like right now:
class BasicTemplateFuturesAlgorithm(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2019, 1, 27)
self.SetEndDate(2019, 1, 28)
self.SetCash(1000000)
#Set timezone
self.SetTimeZone(TimeZones.NewYork)
#Brokerage model and account type:
self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Margin)
# Subscribe and set our expiry filter for the futures chain
futureES = self.AddFuture(Futures.Indices.SP500EMini)
futureES.SetFilter(timedelta(0), timedelta(182))
futureGC = self.AddFuture(Futures.Metals.Gold)
futureGC.SetFilter(timedelta(0), timedelta(182))
benchmark = self.AddEquity("SPY");
self.SetBenchmark(benchmark.Symbol);
# sar info
self.psar = self.PSAR(self.Futures.Indices.SP500EMini, 0.02, 0.02, 0.2, Resolution.Daily)
The line used in the Forex example is:
self.psar = self.PSAR(self.forex.Symbol, 0.02, 0.02, 0.2, Resolution.Daily)
I've tried a lot of different combinations like this:
self.psar = self.PSAR(self.futures.Symbol, 0.02, 0.02, 2, Resolution.Daily)
self.psar = self.PSAR(futureES, 0.02, 0.02, 2, Resolution.Daily)
psar = PSAR(futureES, 0.02, 0.02, 2, Resolution.Daily)
I just keep getting errors either that my object doesn't have the attribute or something along those lines.
Does anyone know how to use the parabolic sar indicator on futures contracts?