Kaufman's Adaptive Moving Average: an EMA whose smoothing constant is chosen
bar by bar from how directed the recent move was.
The efficiency ratio divides the net distance travelled over erLength bars by
the total path walked to get there. A clean trend covers ground in a straight
line and scores near 1, which pulls the smoothing toward the fast alpha and the
average onto price; chop retraces itself, scores near 0, and the average all but
stops. Squaring the interpolated alpha is what makes that transition abrupt
rather than linear, so KAMA sits flat through noise instead of drifting.
The reference delegates to an external kama() helper, whose body is not in the file, so
this follows Kaufman's published definition. It first prints at erLength, the
earliest bar where both legs of the ratio exist, seeded there on the source
itself, because there is no prior average to carry forward.
Kaufman's Adaptive Moving Average: an EMA whose smoothing constant is chosen bar by bar from how directed the recent move was.
The efficiency ratio divides the net distance travelled over
erLengthbars by the total path walked to get there. A clean trend covers ground in a straight line and scores near 1, which pulls the smoothing toward the fast alpha and the average onto price; chop retraces itself, scores near 0, and the average all but stops. Squaring the interpolated alpha is what makes that transition abrupt rather than linear, so KAMA sits flat through noise instead of drifting.The reference delegates to
an externalkama()helper, whose body is not in the file, so this follows Kaufman's published definition. It first prints aterLength, the earliest bar where both legs of the ratio exist, seeded there on the source itself, because there is no prior average to carry forward.