KAMA
A moving average that speeds up in clear trends and slows down in choppy markets.
Kaufman adaptive moving average. Efficiency ER = |x − x[period]| ÷ Σ|x − x[1]| over period changes; sc = (ER × (2 ÷ (fast + 1) − 2 ÷ (slow + 1)) + 2 ÷ (slow + 1))²; kama = prev + sc × (x − prev), seeded with the previous candle's value. Ready at period + 1 candles. A flat window (Σ changes 0) is not ready and leaves the average unchanged.
Settings
| Setting | Default | Range | What it does |
|---|---|---|---|
| period | 10 | 1 to 1000 | Changes in the efficiency ratio. |
| fast | 2 | 1 to 1000 | Fastest EMA period. |
| slow | 30 | 1 to 1000 | Slowest EMA period. |
What it gives
| Output | What it is |
|---|---|
| kama | The average, in price. |
What it reads
It reads open, high, low, close, hl2, hlc3, ohlc4, hlcc4, close by default.
Warm-up
With its default settings, KAMA needs 311 closed candles before its first value. A backtest loads them before its start date, so the first trade can already use it.
Test it
Copy this sentence into the Algonney chat to backtest it:
Backtest a strategy on BTC that uses KAMA with its default settings