Data required to avoid recursive loop issue

Below are required data multiplier to avoid recursive loop issue. For example, EMA need 3x data, which means to calculate EMA with length of 200, it needs at least 600 rows of data.

Note: the list below will be updated when needed

Unavoidable lookahead bias

  • qtpylib.cci
  • qtpylib.vwap

Unavoidable recursive loop issue

  • ta.AD
  • ta.OBV
  • qtpylib.pvt
  • pandas_ta.ebsw (can’t work on recursive test)

General rule of thumb

3x multiplier

  • ta.EMA
  • ta.DEMA
  • ta.BBANDS using matype = 1 (EMA)
  • ta.BBANDS using matype = 3 (DEMA)
  • smi_momentum (nilux)

4x multiplier

  • qtpylib.rolling_weighted_mean
  • qtpylib.hull_moving_average
  • qtpylib.hma

5x multiplier

  • ta.KAMA
  • ta.TEMA
  • ta.BBANDS using matype = 4 (TEMA)
  • ta.BBANDS using matype = 6 (KAMA)
  • ta.ADOSC
  • ta.MACDEXT based of slowperiod, when slowmatype = 2 (WMA)
  • ta.MACDEXT based of slowperiod, when slowmatype = 5 (TRIMA)

6x multiplier

  • ta.MACDFIX
  • ta.TRIX
  • Elliot Wave Oscillator using EMA

7x multiplier

  • ta.T3
  • ta.APO using matype = 1 (EMA)
  • ta.PPO based of slowperiod, when matype = 1 (EMA)
  • ta.PPO based of slowperiod, when matype = 6 (KAMA)
  • pandas_ta.apo using matype=”ema”
  • pandas_ta.bias using matype=”ema”

8x multiplier

  • ta.MINUS_DI
  • ta.MINUS_DM
  • ta.PLUS_DI
  • ta.PLUS_DM
  • ta.RSI
  • ta.ATR
  • ta.NATR
  • ta.APO using matype = 3 (DEMA)
  • ta.APO using matype = 4 (TEMA)
  • ta.MACD based of slowperiod, when fastperiod < slowperiod
  • ta.MACDEXT based of slowperiod, when slowmatype = 1 (EMA)
  • ta.MACDEXT based of slowperiod, when slowmatype = 3 (DEMA)
  • ta.PPO based of slowperiod, when matype = 3 (DEMA)

9x multiplier

  • ta.STOCHRSI
  • pta.cmo
  • ta.MACDEXT based of slowperiod, when slowmatype = 4 (TEMA)
  • ta.PPO based of slowperiod, when matype = 4 (TEMA)

10x multiplier

  • ta.APO using matype = 6 (KAMA)
  • ta.MACDEXT based of fastperiod, when fastmatype = 1 (EMA) while slowmatype = 0 and signalmatype = 0

11x multiplier

  • ta.MACDEXT based of slowperiod, when slowmatype = 6 (KAMA)

12x multiplier

  • ta.DX

13x multiplier

  • ta.ADX
  • ta.ADXR
  • ta.CMO

16x multiplier

  • ta.MACD[‘macd’] based of fastperiod

Case-by-case indicators

Indicators in this category will have to be manually checked using recursive-analysis to make sure your startup_candle_count is enough.

pta.kama

This indicators have length, fast, and slow variables, which affect the required startup candle. I won’t be able to give the general formula for it. What I found out so far is that for startup_candle_count of 999, maximum length you can use is 200 and use the default fast and slow

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *