KAMA

All functions · nseries package

KAMA

func (s Series) KAMA(n int, speeds ...int) Series

KAMA implements Kaufman’s Adaptive Moving Average across the provided series. Note that Kaufman recommends that the fast value be only 2 or 3, and the slow value be fixed at 30, which are the defaults. Either or both speeds may be overridden by passing one (fast) or two (fast, slow) values. Values of n less than one, or greater than the series length, return a copy of the original Series.

Bars 0 to n-1 pass the input through (result[i] = s[i]), the recursion starts at bar n from result[n-1] = s[n-1], and the first adapted bar is n. It reads EfficiencyRatio(n) only from bar n on, so the ratio’s warm-up never enters it: the ratio’s warm-up changed from 0.5 to 0 on 3 October 2026 with no effect on KAMA, bit for bit.