Kaufman's Adaptive Moving Average
systemic:core-kamaIndicatorsInputs
| Name | Type | Description |
|---|---|---|
| Window | Whole number | The number of bars used to calculate the Efficiency Ratio (ER), often written as $N$. |
| Slow Period | Whole number | The EMA length that KAMA approaches in a choppy market; it sets the most smoothing KAMA applies. |
| Fast Period | Whole number | The EMA length that KAMA approaches in a strong trend; it sets the least smoothing KAMA applies. |
| Price | Number series | The price series KAMA is calculated on, usually closing prices. |
Outputs
| Name | Type | Description |
|---|---|---|
| KAMA | Number series | The adaptive moving average value for each bar of the price series. |
Cost
0.209 + 0.00575·n credits for n bars, rounded up. The marks are each plan's limit of bars.
At a Glance
where
KAMA is a moving average that adapts. When the market trends strongly, it follows price closely. When the market moves sideways, it smooths more to filter noise. The Efficiency Ratio controls this behavior.
The Problem KAMA Solves
Traditional moving averages force a trade-off:
flowchart LR
subgraph Problem["The Moving Average Dilemma"]
direction TB
Fast["🏃 Fast MA<br/>Responsive to trends<br/>But noisy in ranges"]
Slow["🐢 Slow MA<br/>Smooth in ranges<br/>But lags in trends"]
end
Fast <--> |"Pick your poison"| Slow
Fast moving averages (like a 10-bar EMA) react quickly to price changes. This is good in trends, but gives whipsaws in sideways markets.
Slow moving averages (like a 50-bar SMA) filter out noise well. But when they signal a trend, much of the move is already over.
KAMA's solution: Do not choose. Let the market decide when to be fast and when to be slow.
The Mathematics of Adaptation
KAMA is built from three parts: the Efficiency Ratio, the Smoothing Constant, and the recursive update formula.
Step 1: The Efficiency Ratio (ER)
The Efficiency Ratio measures how efficiently price moved from point A to point B. It asks: "Of all the price movement, how much was directional and how much was noise?"
Numerator (Change): The absolute net price change over the window: how far price actually traveled.
Denominator (Volatility): The sum of all absolute bar-to-bar changes: the total "path length" of price.
| ER Value | Market Condition | Interpretation |
|---|---|---|
| ER = 1 | Perfect trend | Price moved in one direction only—no retracements |
| ER = 0 | Pure noise | Price ended exactly where it started despite movement |
| ER ≈ 0.5 | Mixed | Some trend, some noise—typical market behavior |
Why absolute values? Direction doesn't matter when measuring efficiency. A 10-point drop is equally "directional" as a 10-point rise.
Step 2: The Smoothing Constant (SC)
The Smoothing Constant turns the Efficiency Ratio into a smoothing factor. It moves between a "fast" and a "slow" exponential moving average, based on ER:
where the EMA smoothing factors are:
With the standard values (Fast = 2, Slow = 30):
The squaring trick: KAMA uses in the final formula. This widens the difference between trending and ranging markets. When ER is low, becomes very small and KAMA is nearly flat.
Step 3: The KAMA Update
The final KAMA value is calculated recursively:
This is the same structure as an EMA, but with a dynamic smoothing factor instead of a fixed one.
flowchart TD
A[Price Data Series] --> B[Calculate Change]
A --> C[Calculate Volatility]
B --> D["Efficiency Ratio (ER)"]
C --> D
D --> E[Apply Fast/Slow SC]
E --> F["Smoothing Constant (SC)"]
F --> G["Square SC → SC²"]
G --> H[Recursive KAMA Update]
H --> I[KAMA Output Series]
How KAMA Adapts: A Visual Guide
The link between the Efficiency Ratio and KAMA's behavior is the core of the indicator:
flowchart LR
subgraph ER["Efficiency Ratio Spectrum"]
direction TB
ER0["ER → 0<br/>Choppy/Noisy<br/>Market"]
ER1["ER → 1<br/>Strong Trend<br/>Market"]
end
subgraph SC["Smoothing Response"]
direction TB
SC0["SC → Slowest<br/>30-bar EMA<br/>More Smoothing"]
SC1["SC → Fastest<br/>2-bar EMA<br/>Less Smoothing"]
end
ER0 -.-> SC0
ER1 -.-> SC1
Interpreting KAMA Signals
Trend Direction
The simplest use: KAMA slope indicates trend.
| KAMA Behavior | Signal | Confidence |
|---|---|---|
| Rising with steep slope | Bullish trend | High (ER is high) |
| Falling with steep slope | Bearish trend | High (ER is high) |
| Nearly flat | No clear trend | Market is ranging |
Price-KAMA Crossovers
When price crosses above or below KAMA, it often signals a trend change. However, KAMA's adaptive nature means crossovers in trending markets are more significant than crossovers during chop.
sequenceDiagram
participant Price
participant KAMA
participant Trader
Note over Price,KAMA: Ranging Market (Low ER)
Price->>KAMA: Multiple crossovers
KAMA-->>Trader: ⚠️ Filter these signals
Note over Price,KAMA: Trending Market (High ER)
Price->>KAMA: Decisive crossover
KAMA->>Trader: ✅ Act on this signal
Dual-KAMA Strategy
One approach uses two KAMA lines with different responsiveness:
- Faster KAMA: Lower fast period (e.g., KAMA with Fast = 2)
- Slower KAMA: Higher fast period (e.g., KAMA with Fast = 5)
When the faster KAMA crosses above the slower KAMA, it signals a possible trend acceleration, and the reverse.
Practical Applications
1. Cryptocurrency Volatility Regime Detection
Cryptocurrencies like Bitcoin alternate between strong trends and long consolidation. KAMA's Efficiency Ratio works as a volatility regime detector.
The Insight: When ER stays above 0.6 for a long time, the market is in a trending regime, which suits momentum strategies. When ER stays below 0.3, mean-reversion or range-trading strategies fit better.
System Design Idea:
- Connect a cryptocurrency price series to KAMA
- Track ER over time (you can approximate it by how quickly KAMA responds to price)
- When KAMA closely tracks price (high ER regime), tilt toward trend-following
- When KAMA moves slowly despite price swings (low ER regime), tilt toward range-trading
This lets you adapt your strategy to market conditions, as KAMA adapts its own smoothing.
2. Multi-Timeframe Trend Confirmation
A classic problem: short-term signals that go against the larger trend lead to losses. KAMA on several timeframes helps.
Implementation:
- Apply KAMA to daily data for the "macro" trend direction
- Apply KAMA to hourly data for entry timing
- Only use signals when both timeframes agree
For example, if daily KAMA is rising and price pulls back to hourly KAMA during a consolidation (low hourly ER), a bounce off hourly KAMA becomes a high-probability long entry.
3. Dynamic Position Sizing Based on Trend Quality
Most position sizing methods use fixed percentages or volatility adjustments (like ATR). KAMA suggests another approach: scale position size with trend quality.
The Concept:
- When KAMA is responsive (high ER), trends are clean—increase position size
- When KAMA is sluggish (low ER), markets are noisy—reduce position size
This is more than risk management: the size follows the quality of the trend.
Advantages Over Other Moving Averages
| Feature | SMA | EMA | KAMA |
|---|---|---|---|
| Lag in trends | High | Medium | Low (adaptive) |
| Noise filtering in ranges | Low | Low | High (adaptive) |
| Parameter sensitivity | High | Medium | Lower (self-adjusting) |
| Complexity | Simple | Simple | Moderate |
Because KAMA adjusts itself, it needs less parameter tuning. You still choose the window, fast period and slow period, but a less than ideal choice matters less.
Limitations and Considerations
Lag still exists. KAMA has less lag than slow moving averages, but it cannot remove it. In very fast markets, such as crypto flash crashes, KAMA also trails price.
Not a forecast. KAMA shows what the market has been doing, not what it will do. A high ER today does not guarantee the trend continues tomorrow.
The squaring effect. Because SC is squared, KAMA can become very unresponsive during choppy periods. This is usually desirable, but in some cases you may miss the start of a new trend.
Initial value matters. The first window − 1 bars are empty (the warm-up). The first KAMA value equals the price on that bar, and later values adapt from there.
References and Further Reading
- StockCharts: Kaufman's Adaptive Moving Average — Comprehensive calculation guide with examples
- Investopedia: KAMA — Beginner-friendly overview
- Corporate Finance Institute: KAMA — Step-by-step calculation walkthrough
- Binance Academy: Moving Averages in Crypto — Crypto-specific applications
- Perry Kaufman, Trading Systems and Methods (6th Edition, Wiley, 2019) — The definitive source from the creator
Glossary
| Term | Definition |
|---|---|
| Efficiency Ratio (ER) | A measure of directional movement relative to total movement; ranges from 0 to 1 |
| Smoothing Constant (SC) | The adaptive factor that controls KAMA's responsiveness |
| Fast Period | The shortest EMA length, used when ER = 1 (maximum responsiveness) |
| Slow Period | The longest EMA length, used when ER = 0 (maximum smoothing) |
| Window (N) | The look-back window for calculating the Efficiency Ratio |
| Crossover | When price moves from one side of KAMA to the other |
| Whipsaw | A false signal where price crosses a moving average but quickly reverses |
Data Alignment and Timeframe Considerations
Single series input: KAMA only needs a price series, so there is nothing to align with other series. The output has one value per bar of the Price input.
Constant parameters: Window, Fast Period and Slow Period are fixed values set on the module, not series.
Minimum data: The price series must have at least as many bars as the largest of Window, Slow Period and Fast Period. With fewer bars, the module returns an error.
Missing Data
A closed-market or missing bar stays empty in the output. No value is filled in or repeated. The Efficiency Ratio and the KAMA update use only bars that have a price (a window-bar ER counts window bars with a price):
- Gaps are bridged: Friday and Monday are treated as two bars next to each other, and KAMA continues across the gap. The weekend bars themselves are empty.
- Warm-up: the first
window− 1 bars with a price are empty. A partial-window value is never returned. - All bars missing: every bar of the output is empty.
Indicator Profile
quadrantChart
title KAMA Indicator Profile
x-axis Low Popularity --> High Popularity
y-axis Low Reliability --> High Reliability
quadrant-1 High potential
quadrant-2 Established leaders
quadrant-3 Niche tools
quadrant-4 Popular but risky
KAMA - Stocks: [0.55, 0.80]
KAMA - Crypto: [0.50, 0.75]
| Dimension | Stocks | Crypto | Notes |
|---|---|---|---|
| Popularity | 5.5/10 | 5.0/10 | Less known than SMA/EMA; favored by systematic traders |
| Reliability | 8.0/10 | 7.5/10 | Self-adjusting reduces false signals; crypto volatility tests limits |
| Complexity | 6.5/10 | 6.5/10 | Requires understanding of ER and smoothing mechanics |
| Versatility | 8.0/10 | 8.0/10 | Works across timeframes and asset classes |
| Recent Interest | 6.0/10 | 6.5/10 | Growing use in systematic trading; well suited for crypto regime detection |
This documentation is for educational purposes only and does not constitute investment advice. Markets involve risk, and past performance does not guarantee future results. Always conduct your own research and consult with qualified professionals before making investment decisions.