Kaufman adaptive moving average
All indicators

LibraryTrend

Indicator

Kaufman adaptive moving average

Perry Kaufman's adaptive average: it moves fast when price trends cleanly and almost stops when price only swings back and forth.

TrendOn the price4 inputsKAMA

How it is calculated

The efficiency ratio ER is the absolute net change over length bars divided by the sum of the absolute bar to bar changes, 1 when nothing moved. The factor is (ER times (2/(fast+1) minus 2/(slow+1)) plus 2/(slow+1)) squared, and KAMA moves that share of the way to the price each bar. As TA-Lib's KAMA the first value needs length + 1 bars and starts from the previous price; fast 2 and slow 30 are TA-Lib's fixed values.

Reference: TA-Lib KAMA (Kaufman 1995)

How to read it

A flat KAMA means noise, a sloping one a trend. Price crossing it says more than with a fixed average because the line barely moves in a range, but after a long flat phase it reacts late to a breakout.

In a strategy

A trend filter or trailing line: go long when the close crosses above ctx.ind("kama", length=10, fast=2, slow=30) while the line itself is rising.

Inputs

InputTypeDefaultRange or choices
LengthlengthWhole number10min 1, max 5000
Fast lengthfastWhole number2min 1, max 500
Slow lengthslowWhole number30min 1, max 500
SourcesourcePrice"close"close, open, high, low, hl2, hlc3, ohlc4, hlcc4

What it draws

LineDrawn as
KAMALine

Used in

No strategy template reads it yet.

OrionQuant