Concept

MAMA/FAMA

MAMA/FAMA, also known as MESA adaptive, is a Trend concept. The Library holds 1 implementation, a working definition you can pull into Quant.

Top MAMA/FAMA indicator

The top custom implementation, built on the original standard MAMA/FAMA formula.

1 total

The MAMA/FAMA implementation below can become a backtested trading strategy — describe your rules and Quant writes the code.

What is MAMA/FAMA?

MAMA is John Ehlers' MESA Adaptive Moving Average, published in 2001; FAMA, the Following Adaptive Moving Average, is its companion line. MAMA is an EMA whose smoothing factor is recomputed every bar from the rate of change of the dominant cycle's phase, measured with a Hilbert Transform discriminator. When phase rotates quickly, meaning price is behaving cyclically, the factor is forced toward its slow limit and the line goes nearly flat, ignoring the swings. When phase advance stalls because price has broken into a directional move, the factor snaps toward its fast limit and the average jumps to price. The result is a distinctive stair-step ratchet.

FAMA is an EMA of MAMA run at half of MAMA's current factor, so it covers ground at half the speed and acts as the signal line. Ehlers' published bounds are a fast limit of 0.5 and a slow limit of 0.05. Because the pair is built to separate only when price genuinely moves, their crossovers were designed to whipsaw less than fixed-length moving average crossovers; ranging markets can still produce failed signals.

John Ehlers, an engineer who spent his career importing digital signal processing into market analysis, published MAMA in a 2001 Technical Analysis of Stocks & Commodities article, quipping that the acronym could as well stand for Mother of Adaptive Moving Averages; MESA is the maximum entropy spectral analysis his earlier cycle work was built on. Like his other filters and cycle tools, it rests on one premise: markets alternate between cycle mode and trend mode, and an indicator should measure which is in force rather than assume one.

The measurement is the interesting part. A Hilbert-style discriminator estimates the dominant cycle's phase each bar; a clean 30-bar cycle advances about 12 degrees per bar, and that steady advance is what pins the factor near its slow limit until a trend stalls the rotation. The scheme has honest caveats: the phase estimate needs dozens of bars to stabilize, behaves oddly around gaps, and rests on a cycle model of price, an assumption rather than a fact.

How to read MAMA/FAMA on a chart

The pair is easiest to recognize by its ratchet:

  1. 1Plot the study with Ehlers' published defaults; most platforms ship the 0.5 and 0.05 limits.
  2. 2Watch the step pattern: flat shelves through choppy stretches, then a jump toward price when a directional move starts; the stair-step is the design working.
  3. 3Mark crossovers: MAMA crossing above FAMA is the conventional bullish event and below it bearish; repeated rapid crosses usually mean the cycle measurement is struggling with the tape.
  4. 4Read separation as regime: wide, ordered distance means the factor is running fast (trend); braided flat lines mean it is pinned slow (cycle).
  5. 5Give it history: the recursive phase measurement needs a few dozen bars to settle, so distrust the earliest values on a freshly loaded chart.

How it's calculated

An adaptive moving average whose smoothing speed is reset every bar from the phase change of the dominant price cycle, with FAMA as a half-speed companion line.

Phaset=arctan(Q1t/I1t)\operatorname{Phase}_t = \arctan(Q1_t / I1_t)
ΔPhaset=max(Phaset1Phaset, 1)\Delta\operatorname{Phase}_t = \max(\operatorname{Phase}_{t-1} - \operatorname{Phase}_t, \ 1)
αt=max(FastLimit/ΔPhaset, SlowLimit)\alpha_t = \max(\operatorname{FastLimit} / \Delta\operatorname{Phase}_t, \ \operatorname{SlowLimit})
MAMAt=αt×Pt+(1αt)×MAMAt1\operatorname{MAMA}_t = \alpha_t \times P_t + (1 - \alpha_t) \times \operatorname{MAMA}_{t-1}
FAMAt=0.5×αt×MAMAt+(10.5×αt)×FAMAt1\operatorname{FAMA}_t = 0.5 \times \alpha_t \times \operatorname{MAMA}_t + (1 - 0.5 \times \alpha_t) \times \operatorname{FAMA}_{t-1}
P_t: source price at bar t (Ehlers uses (high + low) / 2)
t: bar index
I1_t: in-phase component of the smoothed, detrended price at bar t, from Ehlers' Hilbert transform
Q1_t: quadrature component of the smoothed, detrended price at bar t, from the same transform
arctan: inverse tangent, returning degrees
Phase_t: phase of the dominant cycle at bar t, in degrees
DeltaPhase_t: bar-to-bar phase decrease, floored at 1 degree
FastLimit: fastest allowed smoothing factor (default 0.5)
SlowLimit: slowest allowed smoothing factor (default 0.05)
alpha_t: adaptive smoothing factor at bar t
MAMA_t: MESA adaptive moving average at bar t
FAMA_t: following adaptive moving average at bar t

Published by John Ehlers (2001); I1 and Q1 come from his Hilbert transform pipeline (4-bar weighted price smooth, detrender, quadrature filters and homodyne discriminator) as defined in his published code.

Slow phase advance, typical of trending price, pushes alpha toward FastLimit so MAMA hugs price; fast phase advance pushes alpha toward SlowLimit so MAMA flattens.

Because DeltaPhase is floored at 1 degree, alpha never exceeds FastLimit; MAMA/FAMA crossovers are the standard signal.

How traders use it

  • As a crossover system: MAMA above FAMA is the conventional long bias and below is the short bias, with the adaptive factor intended to keep signals sparse in cycle mode.
  • As a regime read: wide, ordered separation between the lines is treated as trend, while braided flat lines are treated as cycle conditions better suited to mean-reversion tactics; that read can feed a trend regime label directly.
  • As an adaptive smoothing core in other tools, replacing a fixed length so downstream logic inherits the fast-attack, slow-decay behavior.
  • As a rail for dynamic support and resistance: the flat shelves give pullbacks a stationary reference to test, unlike a conventional average that drifts continuously.
  • As a directional filter: taking breakout or momentum entries only in the direction of the MAMA/FAMA spread, the usual division of labor between a slow regime line and fast triggers.

MAMA/FAMA vs related averages

EMA: The fixed-alpha baseline MAMA generalizes. An EMA commits to one speed for all conditions; MAMA re-derives its factor every bar from measured cycle phase, so it runs slow in chop and fast in trends instead of one compromise everywhere.

Adaptive-lookback MA: The same ambition with a different sensor. Most adaptive averages steer by efficiency or volatility ratios, which change gradually; MAMA steers by cycle phase, so its stair-step signature is more abrupt than ratio-driven designs' smooth speed changes.

Ehlers SuperSmoother: Same author, different tool: a fixed low-pass filter with no adaptation, built to remove wavelengths shorter than a chosen period. The SuperSmoother smooths uniformly; MAMA switches personality with the regime it measures.

Concept family

Trend

100 concepts mapped · 100 in the Library

MAMA/FAMA FAQ

Turn MAMA/FAMA into a trading strategy.

Take the implementation from this page into Quant, then build on it, backtest it on real data, and keep refining it in conversation.