Loading…

Kaufman Adaptive Moving Average

A fixed-period moving average smooths the same amount whether the market is trending cleanly or churning sideways, which is exactly backwards from what a trader wants. KAMA fixes this by computing an efficiency ratio each bar - net directional change over the lookback window divided by the sum of every bar-to-bar change in that window - and using it to slide the smoothing constant between a fast EMA-equivalent and a slow one. An efficiency ratio near 1 (price moved in a straight line) pushes the constant toward the fast end; a ratio near 0 (price churned back and forth) pushes it toward the slow end, where the line barely moves at all. The one thing every KAMA implementation has to get right is that it is recursive - each value depends on the previous one - so it needs a genuine starting point rather than a guess. This implementation seeds the line with price at the oldest bar the efficiency ratio can actually be computed for, then walks forward one bar at a time exactly as Kaufman's original formulation does. That seed happens once, on the initial calculation, and is never revisited, so the line does not repaint once it has been drawn. Notes and limitations - The line needs InpErPeriod closed bars of history before the first value can be computed; bars older than that stay empty rather than showing a guessed value. - Like any moving average, it lags - the efficiency ratio changes the speed of the lag, it does not remove it. - This is a plotting-only indicator: it draws no arrows and fires no alerts.

Indicator · MT5 · v1.0 · Free

About Kaufman Adaptive Moving Average

Kaufman Adaptive Moving Average is an indicator for MetaTrader 5. It has 3 settings, such as Er period, Fast period and Slow period. MQL source code included.

Files in the download: KaufmanAma.ex5, KaufmanAma.mq5, KaufmanAma.txt.

Settings

SettingDefaultWhat it does
Er period10Efficiency ratio lookback (Kaufman's default)
Fast period2Fastest EMA period the smoothing constant can reach
Slow period30Slowest EMA period the smoothing constant can reach

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Indicators.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: Moving Average · Trend · MT5 Indicator · MQL5 Source Code

MetaTrader 4 & 5 indicators · PolyMaria