A moving average that changes its own speed using an efficiency ratio — adaptive to past noise, not predictive of future conditions.
The Kaufman Adaptive Moving Average was developed by Perry Kaufman and presented in his 1995 book Smarter Trading. It is a moving average plotted on price whose smoothing speed changes bar by bar instead of staying fixed. The speed is set by an Efficiency Ratio: how much net ground price covered over a lookback window divided by the total distance it travelled to get there. When price moves directionally, the ratio is high and KAMA speeds up toward a fast EMA; when price churns back and forth, the ratio collapses and KAMA slows toward a very slow EMA, flattening out. It is important to be precise about the word 'adaptive': KAMA adapts to noise that has already occurred, measured entirely on completed bars. It cannot know whether the conditions it just measured will persist, so its adaptation always trails a regime change rather than anticipating one. Like every moving average, it is descriptive, not predictive. This entry is educational only, not financial advice, and all trading carries risk of loss.
Three steps, all deterministic. First, the Efficiency Ratio over n bars (default 10): ER = |close − close[n]| divided by the sum of |close − close[1]| across those n bars. If price travelled 100 points of path to move 100 points net, ER = 1; if it travelled 100 points to go nowhere, ER = 0. Second, the ER is mapped to a smoothing constant between a fast and a slow EMA speed: SC = [ER × (fastSC − slowSC) + slowSC]², where fastSC = 2/(2+1) and slowSC = 2/(30+1) using the defaults of 2 and 30. The squaring is the detail most write-ups skip: it biases the result strongly toward the slow end, so KAMA only moves quickly when ER is genuinely high, and near-zero ER makes the line almost stop updating. Third, the recursive update: KAMA(t) = KAMA(t−1) + SC × (price − KAMA(t−1)) — a standard EMA step whose alpha is recomputed every bar. That is the direct answer to how KAMA adapts its speed: the efficiency of recent price movement continuously re-tunes the EMA coefficient between roughly a 2-period and a 30-period speed, with the square keeping it slow by default.
Kaufman's own defaults are an Efficiency Ratio length of 10 with fast and slow lengths of 2 and 30, applied to the closing price — usually written KAMA(10, 2, 30). The ER length dominates behaviour: shorter values make the speed switching jumpier, longer values make it steadier. With three interacting parameters the tuning space is large, so any claim that a particular combination 'works best' should be treated as a curve-fitting hypothesis to test, not a fact.
//@version=6
indicator("KAMA Example", overlay = true)
erLen = input.int(10, "Efficiency Ratio Length", minval = 1)
fastLen = input.int(2, "Fast Length", minval = 1)
slowLen = input.int(30, "Slow Length", minval = 1)
src = input.source(close, "Source")
netChange = math.abs(ta.change(src, erLen))
totalPath = math.sum(math.abs(ta.change(src)), erLen)
er = totalPath != 0 ? netChange / totalPath : 0.0
fastSC = 2.0 / (fastLen + 1)
slowSC = 2.0 / (slowLen + 1)
sc = math.pow(er * (fastSC - slowSC) + slowSC, 2)
float kama = na
kama := nz(kama[1], src) + sc * (src - nz(kama[1], src))
plot(kama, "KAMA", color = color.blue, linewidth = 2)Pro tip: Add the Efficiency Ratio to a separate pane next to KAMA and watch them together: every acceleration and flattening of the average maps directly to an ER move, which demystifies the 'adaptive' label. Remember the ER is measured on completed bars — the adaptation is a rear-view mirror, so build any interpretation around that delay rather than around the marketing word 'adaptive'. Educational context only, not financial advice; no indicator predicts price, and trading involves risk of loss.
Educational only — not financial advice, not a recommendation to trade. No indicator is predictive; trading involves substantial risk of loss.