Using Heikin Ashi candles is crucial to the success of my strategy, but I keep running into this error:


Runtime Error: This is a forward only indicator: HA(EURUSD_min)

Is it simply not possible to use the HA indicator for backtesting? If so, then how could I create custom QuoteBars and feed them to my other indicators?

Here is my Initialize declaration:

def Initialize(self):
# Set the cash we'd like to use for our backtest
# This is ignored in live trading
self.SetCash(1000)
self.Debug("Cash set to $1000")

#Risk management
risk = 0.05 #%
self.Debug("Risking {} per trade!".format(risk*100))

# Start and end dates for the backtest.
# These are ignored in live trading.
self.SetStartDate(2018,5,1)
self.SetEndDate(2018,8,2)

# Set Brokerage model to load OANDA fee structure.
self.SetBrokerageModel(BrokerageName.OandaBrokerage, AccountType.Margin)

# Add assets you'd like to see
PAIR = "EURUSD"
self.AddForex(PAIR, Resolution.Minute, Market.Oanda)
self.Debug("Pair set to: {}".format(PAIR))

#Consolidate minute data into X minute blocks
M15 = QuoteBarConsolidator(15)
M15.DataConsolidated += self.OnDataConsolidated
interval = M15
self.Debug("Time interval set to M15")

#Force the manager (listener) to push new data to the stack when a new
#30 min bar exists
self.SubscriptionManager.AddConsolidator(PAIR, interval)

#Declare all the indicators we will be using:
'''
*Heiken Ashi - convert standard candles to Heiken Ashi to improve
consistency
*MACD(5,15,1) - Small MACD, or SIGNAL. Techncally not a MACD:
(slowEMA - fastEMA)
*MACD(12,26,1) - Big MACD, or MAIN. This isn't a MACD either. See /\
*SMA(50) - Simple Moving Average (no smoothing)
*EMA(8) - Exponential Moving Average
*ADX(10) - Average Directional Index; provides 3 lines in one:
+DI, -DI, and ADX SIGNAL
*RSI(10) - Relative STRENGTH Index; The "big knob" aka.
the indicator that is the most important
'''
self._HA = self.HeikinAshi(PAIR, Resolution.Minute)
self.RegisterIndicator(PAIR, self._HA, M15)
self._MAIN = IndicatorExtensions.Of(self.MACD(PAIR, 12, 26, 1, \
resolution = interval), self._HA)
self._SIGNAL = IndicatorExtensions.Of(self.MACD(PAIR, 5, 15, 1, \
resolution = interval), self._HA)
self._SMA = IndicatorExtensions.SMA(self._HA, 50)
self._EMA = IndicatorExtensions.EMA(self._HA, 8)
self._ADX = self.ADX(PAIR, 10, resolution = interval)
self._RSI = IndicatorExtensions.Of(self.RSI(PAIR, 10, \
resolution = interval), self._HA)

#Setup data storage for indicators that require comparing to
#previous values
self._SIGWindow = RollingWindow[Decimal](2)
self._ADXWindow = RollingWindow[Decimal](3)
self._DIWindow = RollingWindow[Decimal](2)
self._RSIWindow = RollingWindow[Decimal](2)
self._SMAWindow = RollingWindow[Decimal](2)
self._EMAWindow = RollingWindow[Decimal](2)
self._Close = RollingWindow[Decimal](20)
self._Low = RollingWindow[Decimal](20)
self._High = RollingWindow[Decimal](20)

#Make sure the indicators have plenty of data to start with
self.SetWarmup(200)