In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.
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) 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) + nsmooth * (xPrice - nz(nAMA)) plot(nAMA, color=blue, title="KAMA")