There are basically two types of moving averages
- FIR (finite impulse response) filters
- IIIR (infinite impulse response) filters
The value of a finite impulse reponse (FIR) filter only depends on a finite - limited - number of bars. An example for a FIR filter is the SMA. A SMA(20) just averages the last 20 bars, therefore it does not depend from the closing price 21 bars ago.
The value of an infinite impulse response (IIR) filter depends on an infinite number of bars. An IIR filter has a recursive element in its formula. An example for a IIR filter is the EMA. Each value for the EMA is calculated as a weighted average of its previous value and the last closing price. Therefore an EMA(20) depends on all closing prices over the lookback value of the chart. In particular it also depends on the closing price 20 bars, 60 bars or 90 bars ago. However, a the dependance of an EMA(20) on the price 90 bars ago is pretty small. As a rule of thumb you may consider that an EMA(20) is accurate, if the lookback period of your chart exceeds the period of the EMA by a factor 3 to 4. You should be fine with 80 bars for an EMA(20).
The behaviour of the EMA relative of the SMA suggests that you should not use an exponential moving average of the true range, but a simple moving average of the true range. Instead of ATR(N) you may use a SMA(TR, 2*N-1), where TR is the true range and 2N-1 is the period to be used with the SMA. The conversion is necessary, because Wilder used a special vesion of the EMA called Wilder's average, which has a different smoothing factor.
For example if you have an ATR(14), you can replace it with a SMA(TR, 27). The values of the SMA(TR, 27) only depend on the last 27 bars, as it behaves as a FIR filter. NinjaTrader does not have a true range indicator, but you can use the ATR and set the period to 1. Therefore you can replace the ATR(14) indicator with SMA(ATR(1), 27).
Leave a comment: