The KAMA will not change when the interval changes from day to something like 5 minutes or 30 minutes. Allows for more precise trading with the same indicator on a different interval.
study(title="Kaufman Adaptive Moving Average", shorttitle="Kaufman Adaptive Moving Average", overlay = true) day = iff(period == 'D', 390, interval ) dayclose = 390/day Length = input(10, minval=1) * dayclose xPrice = close[dayclose] xvnoise = abs(xPrice - xPrice[1]) Fastend = input(4) Slowend = input(30) nfastend = 2/(Fastend + 1) nslowend = 2/(Slowend + 1) nsignal = abs(xPrice - xPrice[Length]) nnoise = sum(xvnoise, Length) nefratio = iff(nnoise != 0, nsignal / nnoise, 0) nsmooth = pow(nefratio * (nfastend - nslowend) + nslowend, 2) nAMA = nz(nAMA[1]) + nsmooth * (xPrice - nz(nAMA[1])) plot(nAMA, color=blue, title="KAMA")