jacobnie2008

Kaufman Adaptive Moving Average (day)

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.
Open-source script

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.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script 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[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")