# MAMA/FAMA

Also known as: MESA adaptive.
A Trend concept (Moving-average lineage) in the LuxAlgo Library, with 1 indicator implementation.

## 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](https://www.luxalgo.com/library/concept/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](https://www.luxalgo.com/library/concept/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. Plot the study with Ehlers' published defaults; most platforms ship the 0.5 and 0.05 limits.
2. Watch 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. Mark 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. Read separation as regime: wide, ordered distance means the factor is running fast (trend); braided flat lines mean it is pinned slow (cycle).
5. Give 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.

```
Phase_t = arctan(Q1_t / I1_t)
DeltaPhase_t = max(Phase_(t-1) - Phase_t, 1)
alpha_t = max(FastLimit / DeltaPhase_t, SlowLimit)
MAMA_t = alpha_t × P_t + (1 - alpha_t) × MAMA_(t-1)
FAMA_t = 0.5 × alpha_t × MAMA_t + (1 - 0.5 × alpha_t) × 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](https://www.luxalgo.com/library/concept/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](https://www.luxalgo.com/library/concept/dynamic-s-r-via-ma/): the flat shelves give pullbacks a stationary reference to test, unlike a conventional average that drifts continuously.
- As a directional filter: taking [breakout](https://www.luxalgo.com/library/concept/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** (https://www.luxalgo.com/library/concept/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** (https://www.luxalgo.com/library/concept/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** (https://www.luxalgo.com/library/concept/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.

## FAQ

### What is the difference between MAMA and FAMA?

MAMA is the primary adaptive average, recomputed each bar with a smoothing factor derived from the dominant cycle's phase. FAMA is not independent: it is an EMA of MAMA run at half of MAMA's current factor, so it shadows the same path at half speed. Signals conventionally come from the pair crossing, with FAMA as the trailing reference line.

### What do the fast and slow limits do in MAMA?

They clamp the adaptive smoothing factor so it can never leave a set range. Ehlers' article used a fast limit of 0.5, equivalent to about a 3-bar EMA, and a slow limit of 0.05, about a 39-bar EMA. Tightening the bounds tames the ratchet and slows signals; widening them exaggerates the stair-step behavior and adds whipsaw risk.

### What does MESA stand for in MAMA?

Maximum entropy spectral analysis, the high-resolution cycle-measurement technique John Ehlers built his earlier market work around. The indicator itself only needs the phase of the dominant cycle, which it takes from a Hilbert-style measurement rather than a full MESA spectrum.

### Why does MAMA move in stair steps?

Because its speed is binary in practice: while measured phase advances steadily the factor sits near the slow limit and the line barely moves, forming a shelf; when phase stalls at a trend onset the factor jumps toward the fast limit and the line leaps to price. The alternation is the ratchet, and it is intended, not an artifact.

### Do MAMA and FAMA repaint?

Closed-bar values do not change afterward. Two caveats: the current bar moves until it closes, like any average, and because the calculation is recursive with a long warm-up, values near the start of a short history differ slightly from the same dates loaded with more history behind them.

### Do MAMA/FAMA crossovers work in ranging markets?

The design goal is for them to go quiet there: both lines flatten together and crosses become rare. Choppy tape still produces some failed crosses, and those flat-regime signals are the least reliable. Most users read braided, flat lines as a stand-aside or mean-reversion condition rather than trading crosses inside them.

## Implementations in the Library

- MAMA/FAMA (LuxAlgo): https://www.luxalgo.com/library/indicator/mama-fama/

## Related concepts

- SMA: https://www.luxalgo.com/library/concept/sma/
- EMA: https://www.luxalgo.com/library/concept/ema/
- Adaptive-lookback MA: https://www.luxalgo.com/library/concept/adaptive-lookback-ma/
- MA Envelope: https://www.luxalgo.com/library/concept/ma-envelope/
- SWMA: https://www.luxalgo.com/library/concept/swma/
- RMA: https://www.luxalgo.com/library/concept/rma/
- HMA: https://www.luxalgo.com/library/concept/hma/
- KAMA: https://www.luxalgo.com/library/concept/kama/
- JMA: https://www.luxalgo.com/library/concept/jma/
- ZLEMA: https://www.luxalgo.com/library/concept/zlema/

---

Source: https://www.luxalgo.com/library/concept/mama-fama/ (LuxAlgo Library, the encyclopedia of trading & technical analysis). Free to use with attribution: https://www.luxalgo.com/library/license/