I am a bit puzzled and I don't know what I am doing wrong. This code:
class QuantumDynamicProcessor(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2019, 1, 1) # Set Start Date
self.SetCash(200) # Set Strategy Cash
self.AddForex("EURUSD", Resolution.Daily, Market.Oanda)
self.SetBrokerageModel(BrokerageName.OandaBrokerage)
self.heikinAshi = self.HeikinAshi("EURUSD", Resolution.Daily)
self.momentum = self.MOM("EURUSD", 10, Resolution.Daily)
self.movingAverage = self.SMA("EURUSD", 50, Resolution.Daily)
self.RegisterIndicator("EURUSD", self.movingAverage, Resolution.Daily)
self.SetWarmUp(50)
def OnData(self, data):
if not self.Portfolio.Invested:
if self.heikinAshi.Close.Value > self.movingAverage.Current.Value:
self.MarketOrder("EURUSD", 1000)
if self.Portfolio.Invested:
if self.heikinAshi.Close.Value < self.heikinAshi.Open.Value:
self.MarketOrder("EURUSD", -1000)
Results in a Runtime Error.
Runtime Error: AttributeError : 'Identity' object has no attribute 'Value'
at OnData in main.py:line 19
:: if self.heikinAshi.Close.Value > self.movingAverage.Current.Value:
AttributeError : 'Identity' object has no attribute 'Value' (Open Stacktrace)
Isn't this the right way to access the current value of a moving average?