kama

forge.tafunctionSince Forge API 1
Functionpython
forge.ta.kama(source: ArrayLike,period: int = 10,fast_period: int = 2,slow_period: int = 30) -> np.ndarray

Kaufman adaptive average.

Parameters

NameTypeDefault
sourceArrayLike
periodint10
fast_periodint2
slow_periodint30

Indicator: Kaufman adaptive moving average

The smoothing constant is (er * (fast_sc - slow_sc) + slow_sc)^2 with er the efficiency ratio over period bars and sc = 2 / (n + 1) for the fast and slow periods. NaN for the first period bars of each unbroken run.

Classpython
forge.ta.KAMA(**inputs: Any) -> None

Average that speeds up when the price trends and slows down when it chops.

Inputs

NameTypeDefaultRange
sourcesourceclose
periodint101 to 5000
fast_periodint21 to 5000
slow_periodint301 to 5000

sc = (ER * (fast_sc - slow_sc) + slow_sc)^2, with fast_sc = 2 / (fast_period + 1) and slow_sc = 2 / (slow_period + 1)

KAMA[i] = KAMA[i-1] + sc * (x[i] - KAMA[i-1]), seeded with x[period-1]

The first period values are left empty. After a gap the average starts again.