Hi everyone,

I am trying to write a simple script with 5 minutes Heiken Ashi Candles stored in a rolling window. However i am getting this error:

untime Error: This is a forward only indicator: HA(EURUSD_min) Input: 2018-07-01 17:00:00Z Previous: 2018-07-01 17:04:00Z (Open Stacktrace)

 

import numpy as np import decimal as d from datetime import timedelta, datetime class FirstProject(QCAlgorithm): def Initialize(self): self.SetCash(100000) self.SetStartDate(2018,7,1) self.SetEndDate(2018,7,3) self.SetBrokerageModel(BrokerageName.OandaBrokerage) self.AddForex("EURUSD", Resolution.Minute, Market.Oanda).Symbol self.HA = self.HeikinAshi("EURUSD",Resolution.Minute) #rolling windows for actual price self.price_window = RollingWindow[QuoteBar](10) #rolling window for HA indicator self.HA_open_win = RollingWindow[d.Decimal](10) self.HA_close_win = RollingWindow[d.Decimal](10) #Consolidate Heiken Ashi fiveMinuteConsolidator = QuoteBarConsolidator(timedelta(minutes=5)) fiveMinuteConsolidator.DataConsolidated += self.OnDataConsolidated self.SubscriptionManager.AddConsolidator('EURUSD', fiveMinuteConsolidator) self.RegisterIndicator('EURUSD',self.HA, fiveMinuteConsolidator) def OnData(self, data): if not (self.HA.IsReady): return def OnDataConsolidated(self, sender, data): if not (self.HA.IsReady): return self.price_window.Add(data['EURUSD']) self.HA_open_win.Add(self.HA.Open.Current.Value) self.HA_close_win.Add(self.HA.Close.Current.Value) if not (self.price_window.IsReady):return if not (self.HA_open_win.IsReady):return if not (self.HA_close_win.IsReady):return self.Log(self.price_window[0].Ask.Close) self.Log(self.HA_open_win[0])

Author