MAMA
MAMA
Summary
MESA Adaptive Moving Average: an adaptive EMA whose smoothing factor is driven by the dominant-cycle phase rate measured with a Hilbert transform. Emits two lines, MAMA and its slower follower FAMA. MAMA crossing above FAMA is bullish; crossing below is bearish.
Formula
phase = atan(Q1/I1) in degrees; deltaPhase = max(1, prevPhase - phase)
alpha = max(fastLimit/deltaPhase, slowLimit) if deltaPhase>1 else fastLimit
MAMA = alpha*price + (1-alpha)*MAMA_prev
FAMA = (alpha/2)*MAMA + (1-alpha/2)*FAMA_prev
Inputs
inReal— Price series to smooth
Outputs
outMAMA— Adaptive moving average (fast line)outFAMA— Following adaptive moving average, using half the alpha (slow line)
Parameters
| Parameter | Type | Default | Accepted values | Description |
|---|---|---|---|---|
optInFastLimit | real | 0.5 | 0.01–0.99 | Upper bound on the adaptive smoothing factor |
optInSlowLimit | real | 0.05 | 0.01–0.99 | Lower bound on the adaptive smoothing factor |
Properties
Numerical Stability: Initial Unstable Period
| Display Flags |
|---|
| ✅ Overlap Input i |
| ☐ Independent Y-Axis |
| ☐ Candlestick |
Implementation
TA-Lib Definition: mama.c · mama.yaml
| Native | File |
|---|---|
| C | ta_MAMA.c |
| Rust | mama.rs |
| Java | Core_MAMA.java |
TA-Lib is also available for Python, R and more using a wrapper.
Aliases
MESA Adaptive Moving Average, Ehlers MAMA
See Also
MA · WMA · HT_DCPERIOD
References
- John F. Ehlers, Rocket Science for Traders: Digital Signal Processing Applications, John Wiley & Sons (ISBN 0471405671)