Kaufman's Adaptive Moving Average (KAMA) is an intelligent trend-following indicator that automatically adjusts its sensitivity based on market noise. When the market is trending smoothly, KAMA tightens its tracking to capture the move. When the market becomes choppy or sideways, KAMA relaxes its sensitivity to filter out the noise and avoid false signals.
Developed by Perry Kaufman and introduced in his 1995 book "Smarter Trading," KAMA was designed to solve the "noise vs. lag" dilemma. Kaufman recognized that a static moving average is always a compromise: too slow for trends or too fast for noise. KAMA solves this by measuring the "Efficiency Ratio" of the price movement and adjusting its smoothing constant in real-time.
| Period | 10 | ER Lookback window | 10 is standard. Longer = more stable ER measurement. |
| Fast Period | 2 | Max speed (Trending) | 2 is standard. Lower = faster reaction to strong trends. |
| Slow Period | 30 | Min speed (Choppy) | 30 is standard. Higher = better noise filtering in ranges. |
**Configuration note:** The default settings (10, 2, 30) are widely used and robust. Adjusting the Slow Period to 80 or 100 can create an extremely stable filter for long-term trend following.
## Performance Profile
| Operation | Complexity | Description |
|-----------|------------|-------------------|
| Streaming update | O(1) | Running sum for volatility + scalar math |
| Bar correction | O(1) | Efficient state rollback |
| Batch processing | O(N) | Single pass through data |
- **Flat Line:** One of KAMA's best features. When KAMA is flat, it indicates a noise-dominated market. Stay out or trade mean reversion.
- **Steep Slope:** When KAMA angles up or down sharply, it indicates a high-efficiency trend. Enter in the direction of the slope.
#### Crossovers
- **Price Crossover:** Price crossing KAMA is a reliable signal because KAMA tends to be far away from price during noise and close to price during trends.
- **KAMA Cross:** Crossing a short-term KAMA(10) with a long-term KAMA(100) is a powerful trend-following system.
### When It Works Best
- **Trend-Following:** KAMA is arguably the best moving average for trend-following systems because it minimizes "whipsaws" in sideways markets better than almost any other MA.
### When It Struggles
- **Sudden Shocks:** Because KAMA relies on the Efficiency Ratio, a sudden V-shaped reversal might initially look like "noise" (low efficiency) before KAMA realizes it's a new trend. It can lag slightly at the very start of a violent reversal.
## Architecture Notes
This implementation makes specific trade-offs:
### Choice: Running Sum for Volatility
- **Alternative:** Re-summing absolute differences every bar.
- **Trade-off:** State complexity vs CPU cycles.
- **Rationale:** O(1) performance is critical. Maintaining a running sum of volatility allows the indicator to scale to large periods without performance penalty.