Kaufman adaptive moving average

kamamoving_averagesForge API 1

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

Outputs

NameTypeRequiredDescription
kamavalueOptionalcolor theme.accent, style line, width 1
Warm-up
period bars (10 at the defaults)
Repaints
No
Parity
TA-Lib, within 1e-9

Formula

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.