Skip to main content
On this page

KAMA Strategy: Kaufman's Adaptive Moving Average for Trend Trading

· 6 min read
Pineify Team
Pine Script and AI trading workflow research team

Kaufman's Adaptive Moving Average (KAMA) changes its smoothing weight with the efficiency of a price path. A steady move and a large back-and-forth move can have very different efficiency ratios even when both are volatile. KAMA therefore does not simply speed up whenever volatility rises.

Master the KAMA Strategy: Kaufman's Adaptive Moving Average for Enhanced Trading Performance

The Efficiency Ratio​

For a lookback of N bars, divide the absolute net price change by the sum of the absolute one-bar changes across that interval:

ER = absolute(current price − price N bars ago) / sum of absolute one-bar changes.

A nonzero path produces a value between zero and one. A monotonic path has ER equal to one; a path returning to its starting point has ER zero. Neither says whether the move was upward or downward. If every price is identical, the denominator is zero and the implementation must define a fallback.

Correct Smoothing Constants​

The common reference lengths are fast 2 and slow 30. They are lengths, not smoothing coefficients. Convert them before interpolation:

  • Fast coefficient: 2 / (2 + 1), approximately 0.6667.
  • Slow coefficient: 2 / (30 + 1), approximately 0.06452.
  • Adaptive weight: the square of [ER × (fast coefficient − slow coefficient) + slow coefficient].

Update KAMA by adding that weight times the difference between current price and previous KAMA. MetaTrader's Adaptive Moving Average documentation describes the calculation.

For a hypothetical ER of 0.5, the interpolated coefficient is about 0.3656 and the squared weight about 0.1337. A previous KAMA of 100 and current price of 103 therefore give approximately 100.401. These are arithmetic examples, not market results.

Squaring matters: at ER one, the weight is about 0.4444, not 0.6667. At ER zero it is about 0.00416. KAMA consequently does not behave exactly like a 2-period EMA at one extreme or a 30-period EMA at the other.

Check the Implementation Before Comparing Charts​

Initial values, zero-denominator handling, rounding and price source affect results. Compare platforms after a sufficient warm-up and use identical input series.

Pineify's visual KAMA configuration currently exposes Source and Length, with Close and 10 as defaults. Its implementation fixes approximate coefficients at 0.666 and 0.0645; it does not expose independent fast and slow length controls. It uses ER one for a zero-noise window and substitutes zero for a missing previous KAMA in its recurrence. That initialization can distort early values and is an identified implementation limitation to review before relying on early signals. It is not a trading advantage.

Trading Rules to Investigate​

CandidateExact question
Price crossoverDoes a completed close cross from at/below to above KAMA?
Slope filterIs KAMA higher than its previous value, or higher for every bar in a specified run?
PullbackWhat distance counts as a touch, and what confirms a rejection?
Two-line crossoverWhich line actually responds faster under the current adaptive weight?

A 20-period EMA is not always faster than KAMA. Its fixed weight is about 0.0952, which can be above or below KAMA's changing weight. Labeling it a universally faster confirmation line is incorrect.

Likewise, KAMA above its value ten bars ago does not mean it rose on ten consecutive bars. A consecutive-rise rule must test every intervening step and decide whether equality resets the count.

A Price-Crossover Baseline​

As an untested research baseline, use Close with ER length 10 and reference lengths 2 and 30 in an implementation that supports them. Enter long after a completed close crosses above KAMA; model the next available fill. Exit after a completed cross below, with a separately defined protective stop. Restrict the test to one position at a time and define re-entry after a stop.

If using a stop two ATR units below entry, record the ATR at the signal and decide whether the initial distance is frozen. Determine quantity from the cash risk budget divided by the entry-to-stop distance. Include point value for contracts and currency conversion when necessary. A high ER is not evidence that a larger risk budget is safe.

An ATR stop below KAMA is a different rule: its distance from the entry changes with price's distance from KAMA. It may be much wider than the nominal ATR multiple. Always calculate actual position risk from entry to the stop.

Evaluating RSI and MACD Filters​

An RSI threshold, MACD crossover or ER threshold can be tested against the baseline. Specify whether conditions must coincide on one bar or remain valid within a waiting window. Do not silently switch between an RSI oversold pullback and an RSI-above-50 momentum rule; they select different situations.

Keep a table of all baseline trades and which filters reject them. Compare costs, exposure, average loss, missed large winners and drawdown on the same dates. A quieter line or fewer trades does not establish better net returns. No AAPL 62% win rate, BTC 58% win rate or personal SPY comparison is supported by a reproducible dataset here.

Settings and Testing Workflow​

  1. Record the implementation, source, ER length, reference coefficients, seed and zero-noise behavior.
  2. Verify hand-calculated values on a short sample, then exclude initialization from trading evaluation.
  3. Freeze entries, exits, sizing and fill assumptions before examining the evaluation period.
  4. Compare KAMA with a chosen SMA or EMA using the same position rules and costs.
  5. Test the frozen choice on later data and then paper trade it without retrospectively editing signals.

Use enough history to include different market conditions, and report the number of trades rather than presenting a favorable win rate without its denominator. Standard-candle OHLC data, session selection, corporate actions and venue differences should be documented.

Frequently Asked Questions​

Does KAMA always reduce false signals?

No. Its weight adapts to path efficiency, but price can repeatedly cross a nearly flat KAMA. A comparison needs specified rules and costs.

What do 10, 2 and 30 mean?

Ten is a common ER lookback; two and thirty are reference EMA lengths converted to coefficients before interpolation and squaring. Platform controls can differ.

Does a high ER mean price is rising?

No. ER uses an absolute net change. A persistent decline can also produce a high ER.

Can KAMA be used on different markets and timeframes?

The calculation can be applied to many price series. That does not establish profitable trading rules or an optimal timeframe.

How should I set stops?

Define a stop rule before testing and size from the actual entry-to-stop distance. Include costs and possible gaps; no ATR multiple prevents all whipsaws.