Adaptive Moving Average
AMA
The Adaptive Moving Average changes its own smoothing on every bar: it tracks price closely when a move is directional and flattens out when the market is just oscillating. It is the trend filter you reach for when a fixed-period average is either too slow in trends or too twitchy in ranges.
- Template periods
- 9 / 2 / 30
- Adaptation
- Efficiency ratio
- Scale
- Price
示意性 — 合成資料,非即時報價。
What the AMA tells you
The AMA answers the same question as any average — which way price has been going — but it decides for itself how much to smooth. It measures how much of the recent movement was net travel rather than back-and-forth, and speeds up or slows down accordingly. In a clean trend it behaves like a short average; in chop it goes almost flat and stops generating direction.
- Price above a rising AMA: the trend is up and the line is tracking it
- Price below a falling AMA: the trend is down
- A flat AMA is information, not a failure — it says the market went nowhere
- 1 Measure net travel against total travel
- 2 Turn that ratio into a smoothing constant
- 3 Step the line toward price by that amount
顯示公式與計算詳情
The Adaptive Moving Average is a recursive average whose smoothing constant is recomputed on every bar from how efficiently price has been moving:
- Measure the efficiency ratio over the period N:
ER = |P − P₍ₙ₎| / Σ|Pᵢ − Pᵢ₋₁|. The numerator is net travel from N bars ago to now; the denominator is the total distance covered bar by bar. A straight-line move gives ER near 1; a market that ends where it started gives ER near 0. - Convert the two period bounds into smoothing constants —
fastSC = 2 / (fast + 1)andslowSC = 2 / (slow + 1)— and interpolate with the ratio, then square the result:SC = [ER × (fastSC − slowSC) + slowSC]². Squaring is what makes the quiet end genuinely flat rather than merely slow. - Step the line toward price by that amount:
AMA = AMAprev + SC × (P − AMAprev).
With the MT5 defaults of 9 / 2 / 30, the smoothing constant lives between roughly 0.004 and 0.44 — so the same indicator can behave like a very short average or a very long one depending on nothing but the shape of recent price action. That is the whole idea: the parameter you would otherwise have to guess and re-optimise per regime is being set by the market instead.
In MQL5 the call is iAMA(symbol, period, ama_period, fast_ma_period, slow_ma_period, ama_shift, applied_price) and it returns a handle to one buffer. Both the applied price and all three period arguments are real inputs; the efficiency ratio itself is internal and is not published as a buffer, so a rule that wants to read “how efficient is this market” has to reconstruct it rather than copy it.
訊號
AMA 提供的可回測訊號 — 及每個訊號適合的市場狀態。
Fast / Slow AMA Cross
Builder 可實現Pullback to the AMA
Builder 可實現Waking Up From Flat
進階邏輯MT5 實作
MetaTrader 5 實際計算與繪製的內容——本頁每條規則的依據。
緩衝區
| 索引 | 緩衝區 | MT5 中的繪製方式 | 存放內容 |
|---|---|---|---|
| 0 | MAIN_LINE | Line | The adaptive average itself, plotted on the price scale. iAMA publishes one buffer — the efficiency ratio that drives the adaptation is internal and is not exposed as a second buffer you can read. |
平台說明
最佳適用場景 / 謹慎使用
沒有任何指標具有普適優勢。以下是 AMA 發揮作用的場景 — 以及可能誤導的場景。
最佳適用場景
- Markets that alternate between trending and ranging
- As a directional filter for a faster signal
- When a fixed-period average whipsaws in chop
- Higher timeframes where the regime is stable enough to read
謹慎使用
- Very tight ranges, where the line barely moves at all
- As a standalone entry trigger
- Optimising all three periods at once
- Assuming adaptation removes lag — it only varies it
構建 AMA 策略
將訊號接入進場和出場規則,然後匯出可編譯的 MT5 EA — 無需撰寫程式碼。
- AMA (9 / 2 / 30) on Close
- Bid price compared against the AMA
- AO crosses above zero and price is above the AMA → Open Buy · SL 50 / TP 100
- AO crosses below zero and price is below the AMA → Open Sell
將 AMA 與其他指標組合
單一指標很少獨立有效。這些組合彌補了 AMA 的盲點。
AMA + Awesome Oscillator
- Price above the AMA
- AO crosses above zero
- Buy
AMA + ATR
- Price above the AMA
- ATR sets stop distance
- Buy
No single-flow template pairs the AMA with ATR. Start from AO + AMA and add an ATR node feeding a risk-based lot or stop node — the Fractal Breakout + ATR template shows that wiring.
開啟 Builder →AMA + Moving Average
- AMA above SMA 9
- Price above both
- Buy
No single-flow template pairs the AMA with a fixed-period moving average. Start from AO + AMA and add an MA node with a Compare against the AMA into the existing And gate.
開啟 Builder →AMA + FrAMA
- Price above the AMA
- FrAMA crosses above a fixed average
- Buy
No single-flow template pairs the two adaptive averages. Start from FrAMA vs Fixed EMA and add an AMA node with a Price node into a Compare, joined to the existing Cross with an And gate.
開啟 Builder →參數
在您自己的貨幣對和時間框架上驗證的起始值 — 非保證設置。
| 參數 | 預設值 | 建議測試範圍 | 功能說明 |
|---|---|---|---|
| Period | 9 | 5–30 | The window the efficiency ratio is measured over — how far back the indicator looks to decide whether the market is trending. Short windows switch the line between fast and slow more often; long windows commit to a regime. |
| Fast EMA period | 2 | 2–10 | The fast end of the smoothing range. It sets how responsive the line is allowed to become when travel is efficient. It is a bound on adaptation, not a second average of price. |
| Slow EMA period | 30 | 20–100 | The slow end of the smoothing range — how flat the line goes when the market is churning. Raising it makes quiet periods flatter and the contrast with trends sharper. |
| Applied price | Close | Close / Open / High / Low / Median / Typical / Weighted | Price series the average runs on. iAMA takes this as a real ENUM_APPLIED_PRICE argument, so Median and Typical are available if you want the bar's range folded in. |
| Shift | 0 | 0–3 | Which bar back the node reads the buffer from. Shift 1 evaluates against a fully closed bar. This is the node's read offset, not the indicator's own horizontal displacement. |
初始預設
市場示例
AMA 有效的場景、失效的場景,以及篩選器如何改變結果。
Flat line, then a clean lean
The AMA sits horizontal through a range and starts sloping as price breaks out. Because the line was flat, the crossing is unambiguous and it stays on one side for the whole leg.
Crossing a flat line repeatedly
In a tight range the line barely moves and price oscillates across it. Adaptation reduces the number of these crossings compared with a fixed average, but it does not remove them.
Momentum has to agree
With a momentum condition added, the same cluster of crossings is ignored until something actually flips — which is exactly what the AO + AMA template wires up.
FAQ
- How is the AMA different from an EMA?
- An EMA uses one fixed smoothing constant, so its lag is the same whatever the market is doing. The AMA recomputes its smoothing constant on every bar from an efficiency ratio — net movement divided by total movement over the period. When price travels in one direction the constant moves toward the fast bound and the line tracks closely; when price churns it moves toward the slow bound and the line flattens. Same output shape, variable responsiveness.
- Is the AMA the same as Kaufman's KAMA?
- Yes. MT5 ships Perry Kaufman's Adaptive Moving Average under the name AMA, and iAMA implements the standard KAMA construction with the efficiency ratio and the squared smoothing constant. The defaults of 9 / 2 / 30 are MT5's, and they match the values the Builder's AO + AMA template loads.
- What do the fast and slow periods actually change?
- They set the two ends of the range the adaptation moves between. Lowering the fast period lets the line become more aggressive in clean trends; raising the slow period makes it flatter in chop and therefore a stricter filter. Neither is a moving average of price in its own right, which is the most common misreading of the parameter names.
- Does adaptation remove the lag?
- No, it varies it. The AMA still only reports what price has already done — the difference is that it accepts more lag when lag is cheap (in a range, where you did not want signals anyway) and less when it is expensive (in a trend). Treating an adaptive average as a leading indicator inverts what it is for.
- Can I build an AMA EA without coding?
- Yes for the directional read. The AO + AMA template puts an AMA node against the Bid price with a Compare node and gates a momentum cross on it, exposing period, fast, slow and applied price as EA inputs. Reading the efficiency ratio directly, or detecting the moment the line wakes up from flat, are the exceptions and need custom MQL5.
- How should I validate settings before going live?
- Backtest on quality tick data first, then run the EA on a demo account before risking money. Three periods means a large search space, so optimise one at a time, hold back data the search never saw, and prefer settings that stay profitable across periods over the single in-sample peak — chasing that peak is overfitting the noise. No default or preset here is a performance promise; every value is a starting point to re-validate on your own pair and broker.