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
| Setting | Default | What it does |
|---|---|---|
| Er period | 10 | Efficiency ratio lookback (Kaufman's default) |
| Fast period | 2 | Fastest EMA period the smoothing constant can reach |
| Slow period | 30 | Slowest EMA period the smoothing constant can reach |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Indicators.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Moving Average · Trend · MT5 Indicator · MQL5 Source Code