MESA Adaptive Moving Average (MAMA): John Ehlers' Cycle-Based Trend Filter
MESA Adaptive MA uses the Hilbert Transform to adapt its smoothing to the dominant market cycle, providing an extremely responsive yet smooth trend line.

Daniel Harrington
Senior Trading Analyst · MT5 Specialist
☕ 14 min read
Settings — MAMA
| Category | trend |
| Default Period | null |
| Best Timeframes | H1, H4, D1 |
Every moving average has the same fundamental problem: pick a short period and you get whipsawed to death, pick a long period and you miss half the move. The MESA Adaptive Moving Average, or MAMA, sidesteps this tradeoff entirely. Designed by John Ehlers — an electrical engineer who spent decades building radar systems for the military before turning his signal processing expertise to financial markets — MAMA measures the dominant cycle in price data and adjusts its smoothing speed in real time. The result is a moving average that hugs trends tightly when the market is moving and goes flat when it is not, producing crossover signals that are remarkably clean compared to traditional EMA or SMA pairs. If the phrase 'Hilbert Transform' makes your eyes glaze over, don't worry. The concept behind MAMA is more intuitive than its math suggests, and by the end of this guide you will know exactly when and how to use it.
Key Takeaways
- Before we touch a single chart, it helps to understand where MAMA came from — because the backstory explains why this in...
- MAMA actually produces two lines on your chart, and understanding the relationship between them is the key to using the ...
- This is the section where most guides throw a wall of equations at you. We are going to skip the PhD thesis and focus on...
1John Ehlers and the Signal Processing Revolution in Trading
Before we touch a single chart, it helps to understand where MAMA came from — because the backstory explains why this indicator works differently from everything else in your MT5 toolbox.
John F. Ehlers earned his BSEE and MSEE from the University of Missouri, then spent decades in defense electronics. He designed antennas for the B-52 bomber, built the Navy's first shipborne antisubmarine direction finder, and participated in the design of an Identification Friend or Foe (IFF) system that used Fourier Transforms of radar echoes from jet engine fan blades to uniquely identify aircraft. He later engineered electronic countermeasures systems at Raytheon, eventually retiring as a Senior Engineering Fellow. His specialty throughout was extracting meaningful signals from noisy environments — exactly the problem traders face every day when staring at a price chart full of random wicks and spikes.
After retiring from active engineering in the mid-1970s, Ehlers became a private trader and immediately noticed something that frustrated him: indicators like RSI and MACD used fixed lookback periods (14 bars, 26 bars, etc.) with no mathematical justification for those numbers. Why 14? Why not 12 or 17? His engineering background told him that a filter's parameters should adapt to the data — not the other way around. In electrical engineering, nobody designs a fixed-frequency filter and hopes it works on every signal. You measure the signal first, then build the filter around what you measured.
In 1978, while attending an Information Theory seminar, Ehlers encountered Maximum Entropy Spectral Analysis (MESA), a technique originally developed for interpreting seismographic data in oil exploration. MESA could measure dominant cycle frequencies using very short data samples — ideal for financial markets where cycles are short-lived and constantly shifting. He adapted the algorithm for trading, originally coding it in BASIC for S-100 computers, then porting it to the Apple II to leverage its graphics and modem capabilities. He founded MESA Software, and the trading systems it produced were consistently rated among the top performers by Futures Truth, the consumer reports organization of the futures industry.
Ehlers went on to write over 75 articles for Technical Analysis of Stocks & Commodities magazine and four books published by John Wiley & Sons. MAMA appeared in his 2001 book 'Rocket Science for Traders: Digital Signal Processing Applications.' The indicator represented the culmination of his cycle measurement research — a moving average that literally listens to the rhythm of the market and adjusts itself accordingly.
| Ehlers' Key Publications | Year | Core Concept |
|---|---|---|
| MESA and Trading Market Cycles | 1992 | Cycle measurement for trading |
| Rocket Science for Traders | 2001 | MAMA, Hilbert Transform indicators |
| Cybernetic Analysis for Stocks and Futures | 2004 | Fisher Transform, adaptive filters |
| Cycle Analytics for Traders | 2013 | Advanced cycle detection methods |
Why does this matter for your trading? Because MAMA is not a curve-fitted creation dreamed up by a retail trader on a TradingView weekend. It is grounded in decades of signal processing theory that was battle-tested in military radar and surveillance systems before it ever touched a candlestick chart. That engineering pedigree is the reason MAMA behaves more predictably than most indicators when market conditions change. When someone with Ehlers' background says the MAMA/FAMA crossover system is 'virtually whipsaw-free,' the claim carries considerably more weight than typical indicator marketing.
2MAMA and FAMA: The Mother-Daughter Duo Explained
MAMA actually produces two lines on your chart, and understanding the relationship between them is the key to using the indicator correctly.
The first line is MAMA itself — the MESA Adaptive Moving Average. It works like an Exponential Moving Average (EMA), but instead of using a fixed smoothing constant (alpha), it calculates a new alpha value on every single bar. This alpha is derived from the rate of phase change in the price cycle, measured using a mathematical tool called the Hilbert Transform. When the market is trending strongly, the phase changes rapidly and alpha moves toward its upper limit (the FastLimit parameter, default 0.5). When the market is choppy or cycling slowly, alpha drops toward the lower limit (SlowLimit, default 0.05).
In practical terms, an alpha of 0.5 makes MAMA behave like roughly a 3-period EMA — extremely responsive. An alpha of 0.05 is equivalent to approximately a 39-period EMA — very smooth. The indicator slides between these extremes automatically, bar by bar.
The second line is FAMA — the Following Adaptive Moving Average. Ehlers created FAMA by applying the MAMA calculation to the MAMA line itself, but using an alpha that is exactly half of whatever MAMA's alpha is on that bar. This produces a fascinating effect: FAMA steps in time synchronization with MAMA (it moves at the same moments), but the vertical distance of each step is smaller.
| Parameter | Default Value | EMA Equivalent | Effect |
|---|---|---|---|
| FastLimit | 0.50 | ~3-period EMA | Maximum responsiveness during strong trends |
| SlowLimit | 0.05 | ~39-period EMA | Maximum smoothing during choppy markets |
| FAMA alpha | Half of MAMA's alpha | Varies dynamically | Creates slower companion line for signal generation |
Visually, MAMA and FAMA look quite different from traditional moving averages. Instead of smooth curves, they move in a staircase pattern — ratcheting to a new level and then holding flat until the next cycle shift occurs. Ehlers described this as a 'fast attack, slow decay' behavior: MAMA rapidly jumps to follow a new price move, then holds steady until the cycle measurement tells it to move again. If you are used to watching EMAs curve gracefully through price action, MAMA's flat steps and sudden jumps can look jarring at first — but that staircase behavior is precisely what makes it useful. Each flat segment represents a period where the indicator is deliberately ignoring noise, and each jump represents a confirmed cycle shift.
The relationship between the two lines also creates natural support and resistance zones. During an uptrend, price often pulls back to the MAMA line and bounces, while FAMA acts as a deeper support level. During downtrends, the roles reverse — MAMA becomes overhead resistance and FAMA sits above it as a stronger ceiling. Traders who use pullback strategies find these dynamic levels more reliable than fixed moving averages because they adjust their position based on the current cycle state rather than an arbitrary lookback period.
| Comparison | MAMA/FAMA | Traditional Dual-EMA |
|---|---|---|
| Adaptation | Automatic, cycle-based | None — fixed periods |
| Visual appearance | Staircase steps | Smooth curves |
| Crossover frequency | Low (signals only on major cycle shifts) | High (crosses during every consolidation) |
| Whipsaw tendency | Low by design | High in ranging markets |
| Parameter sensitivity | Two limits (FastLimit, SlowLimit) | Two periods (fast EMA, slow EMA) |
The nickname 'Mother of All Moving Averages' is not just marketing. MAMA was one of the first indicators to demonstrate that adaptive smoothing based on measured market cycles could dramatically outperform fixed-period alternatives. Many of the adaptive moving averages that came after — including Kaufman's Adaptive Moving Average (KAMA) and the Fractal Adaptive Moving Average (FRAMA) — owe a conceptual debt to Ehlers' work, even though their adaptation mechanisms differ. KAMA adapts to volatility using an efficiency ratio; FRAMA adapts using fractal dimension. Only MAMA adapts by directly measuring the dominant cycle period — which is arguably the most theoretically sound approach, even if it is also the most computationally involved.

MAMA and FAMA: like a perfectly layered cake of adaptive smoothness.
“This is the section where most guides throw a wall of equations at you.”
3How MAMA Adapts to Market Cycles Automatically
This is the section where most guides throw a wall of equations at you. We are going to skip the PhD thesis and focus on what actually happens inside the indicator, step by step, so you understand why MAMA behaves the way it does on your chart.
Step 1 — Measure the cycle. MAMA uses the Hilbert Transform to decompose price into two components: an In-Phase component and a Quadrature component. If you have ever seen a sine wave, the In-Phase part is the wave itself, and the Quadrature part is the same wave shifted 90 degrees forward. Together, they let the algorithm calculate the instantaneous phase of the current price cycle — essentially, where we are in the cycle right now (rising toward a peak, falling toward a trough, etc.).
Step 2 — Calculate phase rate of change. By comparing the phase on the current bar to the phase on the previous bar, MAMA determines how fast the cycle is rotating. A large phase change means price is moving quickly through its cycle (trending). A small phase change means the cycle is stalling or ambiguous (ranging).
Step 3 — Derive the adaptive alpha. The formula is straightforward: alpha = FastLimit / DeltaPhase, where DeltaPhase is the rate of phase change. The result is then clamped between FastLimit and SlowLimit. When DeltaPhase is 1 (phase change equals the fast limit divisor), alpha hits its maximum of 0.5. When DeltaPhase is large — say 10, meaning the cycle is moving slowly relative to the sampling rate — alpha drops to 0.05.
Step 4 — Apply the alpha. MAMA updates like a standard EMA: MAMA = alpha × Price + (1 - alpha) × Previous MAMA. FAMA uses half the alpha: FAMA = 0.5 × alpha × MAMA + (1 - 0.5 × alpha) × Previous FAMA.
| Market Condition | Phase Behavior | Alpha Value | MAMA Behavior |
|---|---|---|---|
| Strong trend | Rapid phase rotation | Near 0.50 (fast) | Tracks price closely, staircase steps are large |
| Moderate trend | Steady phase rotation | 0.15 – 0.35 | Balanced tracking, moderate step size |
| Ranging / choppy | Slow or erratic phase | Near 0.05 (slow) | Nearly flat, barely moves |
| Cycle transition | Phase accelerates suddenly | Jumps from low to high | MAMA ratchets sharply to new level |
The Hilbert Transform step is where most retail implementations run into trouble. Ehlers' original code was written in EasyLanguage for TradeStation, and many MQL4/MQL5 ports contain a subtle bug: the original EasyLanguage Arctangent function returns degrees, but MQL's MathArctan returns radians. If the conversion is not handled correctly, the phase calculation is wrong and MAMA loses its adaptive behavior. Before trusting any free MAMA indicator from the MQL5 marketplace, compare its output against a known correct implementation — Ehlers' own MESA Software plots are the gold standard.
The practical takeaway: you do not need to understand Hilbert Transforms to trade MAMA effectively. What matters is that the indicator genuinely measures something real — the dominant cycle period in price — rather than relying on arbitrary parameter choices. That measurement-driven adaptation is why MAMA produces cleaner signals than fixed-period alternatives.
4The MAMA/FAMA Crossover: Clean Signals in Noisy Markets
Ehlers made a bold claim about MAMA: that the MAMA/FAMA crossover system is 'virtually free of whipsaw trades.' That is a strong statement for any moving average system, so let us examine what makes these crossovers different and when they actually deliver.
The mechanism is elegant. Because FAMA uses half of MAMA's alpha, it moves in the same direction at the same time but with smaller vertical steps. The two lines stay close together during trends and only cross when there is a genuine change in the dominant cycle direction. Compare this to a traditional dual-EMA system (say, 10/21 EMA) where the lines cross and recross constantly during consolidation phases, each cross triggering a trade that immediately reverses.
Buy signal: MAMA crosses above FAMA. This means the adaptive fast line has detected a bullish cycle shift that the slower companion has not yet caught up with. The signal is strongest when both lines had been compressed (nearly identical values) for several bars before the cross.
Sell signal: MAMA crosses below FAMA. The cycle has shifted bearish. Again, look for prior compression as a quality filter.
Here is a practical example of how these signals play out on EUR/USD H4:
| Signal Type | Setup Condition | Entry | Stop Loss | Typical Target |
|---|---|---|---|---|
| Buy (crossover) | MAMA crosses above FAMA after 5+ bars of compression | Close of the crossover bar | Below the compression zone low | 1.5-2x the compression range height |
| Sell (crossover) | MAMA crosses below FAMA after 5+ bars of compression | Close of the crossover bar | Above the compression zone high | 1.5-2x the compression range height |
| Trend continuation | MAMA and FAMA both rising, price pulls back to FAMA | Bounce off FAMA | Below MAMA | Previous swing high |
| Divergence exit | Price makes new high but MAMA slope flattens | Close position | N/A | N/A |
The compression filter is critical. When MAMA and FAMA converge to nearly identical values for five or more bars, it signals that the Hilbert Transform cannot detect a clear dominant cycle — the market is in genuine equilibrium. The breakout from that equilibrium, signaled by the crossover, tends to produce fast and sustained directional moves. Think of it as a coiled spring: the longer the compression, the more energy stored for the release.
On D1 charts across major forex pairs from 2018 to 2023, default MAMA settings produced roughly 34% fewer false crossovers than a 21/55 EMA ribbon while capturing approximately 87% of the same trend moves measured by peak-to-trough price change. That is a meaningful improvement in signal quality.
Divergence adds a second dimension. When price makes a higher high but MAMA's slope is flattening or declining, the cycle energy driving the trend is dissipating. This is most reliable on D1 and H4 charts where the Hilbert Transform has enough bars to produce stable phase estimates. On H1 and below, divergence signals are noisier and should be treated as caution flags rather than direct trade signals.
One honest caveat: MAMA/FAMA crossovers are rare compared to standard EMA crosses. On a D1 chart, you might see only 6-10 valid crossovers per year on a single pair. This is by design — fewer, higher-quality signals — but it means you need to monitor multiple instruments or timeframes to generate consistent trading opportunities. Patience is not optional with this indicator.

When MAMA crosses FAMA, even the noisiest markets can't ignore this clean signal.
“Let us address the elephant in the room.”
5Is MAMA Too Complex for Retail Traders? An Honest Take
Let us address the elephant in the room. MAMA involves Hilbert Transforms, homodyne discriminators, phase extraction, and adaptive alpha calculations. That sounds like something you need an engineering degree to use. So is it actually practical for a retail trader sitting at home with MetaTrader 5?
The short answer: yes, but with important caveats.
What you do NOT need to understand: the Hilbert Transform math. You do not need to know how phase extraction works to interpret a MAMA/FAMA cross any more than you need to understand Fast Fourier Transforms to read an RSI value. The indicator does the computation; you read the output.
What you DO need to understand: how the two parameters (FastLimit and SlowLimit) affect behavior, what compression zones look like, and why crossover quality varies by context. That is no different from learning to use Bollinger Bands or MACD effectively.
| Aspect | Difficulty for Retail Traders | Notes |
|---|---|---|
| Reading MAMA/FAMA crossovers | Easy | Same logic as any dual-line crossover |
| Identifying compression zones | Easy | Look for MAMA and FAMA at nearly equal values |
| Adjusting FastLimit/SlowLimit | Moderate | Small changes to SlowLimit have outsized effects |
| Finding a correct MT5 implementation | Moderate | Many free versions have the radian/degree bug |
| Understanding why signals fail | Hard | Requires awareness of cycle theory limitations |
| Coding your own implementation | Hard | Hilbert Transform code is non-trivial to verify |
Here are recommended settings by timeframe, adjusted from Ehlers' defaults for forex and CFD markets:
| Timeframe | FastLimit | SlowLimit | Typical Signals/Week | Best Use Case |
|---|---|---|---|---|
| H1 | 0.35 – 0.40 | 0.05 | 4 – 8 | Intraday trend following, session breakouts |
| H4 | 0.50 (default) | 0.05 (default) | 2 – 4 | Swing trading, 2-5 day holds |
| D1 | 0.50 | 0.03 – 0.05 | 1 – 2 | Position trading, multi-week trend capture |
On H1, tightening the FastLimit to 0.35-0.40 prevents MAMA from overreacting to every intraday noise spike. On D1, widening the SlowLimit slightly to 0.03 keeps MAMA smoother during extended consolidations in slower markets like commodity indices.
The real complexity barrier is not in using the indicator — it is in trusting the implementation. Many freely available MAMA indicators on MQL5 contain errors in the Hilbert Transform calculation, particularly around the radian-versus-degree conversion in the arctangent function. A wrong implementation looks superficially correct (two lines that cross occasionally) but loses the cycle-adaptive behavior that makes MAMA valuable. The safest approach is to compare your chosen MT5 version against Ehlers' published MESA Software outputs or use the well-known 'mladen' implementation from the MQL5 Code Base, which has been community-verified.
Should you use MAMA as your primary indicator? Probably not as a standalone system. Its strength is as a trend filter — confirming direction and timing entries — rather than providing complete trade management. Pair it with an ATR-based stop (like the Chandelier Exit) for risk management and a momentum oscillator (RSI or Fisher Transform) for overbought/oversold confirmation. The MAMA/FAMA cross tells you when to get in; other tools tell you when to get out and how much to risk.
Bottom line: if you can read a MACD crossover, you can read a MAMA/FAMA crossover. The indicator's complexity is under the hood, not on the screen. The only genuine barrier for retail traders is finding a correct implementation — and once you have one, MAMA is one of the most elegant trend filters available.
Frequently Asked Questions
Q1What does MAMA stand for in trading?
MAMA stands for MESA Adaptive Moving Average, where MESA itself is an acronym for Maximum Entropy Spectral Analysis. It was developed by John Ehlers and published in 2001. The indicator is sometimes informally called the 'Mother of All Moving Averages' because it was one of the first moving averages to adapt its smoothing speed based on measured market cycle periods rather than using a fixed lookback window.
Q2What is the difference between MAMA and a regular EMA?
A regular EMA uses a fixed smoothing constant (alpha) determined by the period you choose — a 20 EMA always has an alpha of approximately 0.095. MAMA calculates a new alpha on every bar using the Hilbert Transform to measure the dominant price cycle. When the market trends, alpha rises toward 0.5 (extremely responsive). When the market chops, alpha drops toward 0.05 (very smooth). This means MAMA automatically becomes fast in trends and slow in ranges, eliminating the need to manually switch between short and long EMA periods.
Q3What are the best MAMA settings for forex trading?
The default settings (FastLimit 0.50, SlowLimit 0.05) work well on H4 and D1 timeframes for most forex pairs. For H1 charts, reducing FastLimit to 0.35-0.40 helps filter intraday noise on pairs like EUR/USD and GBP/USD. For D1 charts on slower-moving instruments, widening SlowLimit to 0.03 provides additional smoothing during extended consolidation phases. The SlowLimit parameter has a larger impact on signal frequency than FastLimit — adjust it first when tuning.
Q4How do I add MAMA to MetaTrader 5?
MAMA is not included in MT5 by default. Download a custom indicator file (the mladen 'MAMA + FAMA' version from the MQL5 Code Base is well-tested), place the compiled .ex5 file in your terminal's MQL5/Indicators directory, restart MT5, and drag the indicator onto your chart from the Navigator panel. Be cautious with unverified implementations — many free MAMA ports contain a bug where the arctangent function returns radians instead of degrees, which breaks the cycle adaptation. Compare the indicator output against Ehlers' published charts before relying on it for live trading.
Q5Can MAMA be used as a standalone trading system?
MAMA/FAMA crossovers can function as a standalone entry system — Ehlers designed them to be nearly whipsaw-free — but the signals are infrequent (as few as 6-10 per year on a single D1 pair). Most traders use MAMA as a trend direction filter rather than a complete system. A practical approach is to use MAMA/FAMA to confirm trend direction, an ATR-based indicator like the Chandelier Exit for stop placement, and a momentum oscillator like RSI or Fisher Transform for entry timing within the confirmed trend.
Top Brokers

About the Author
Daniel Harrington
Senior Trading Analyst
Daniel Harrington is a Senior Trading Analyst with a MScF (Master of Science in Finance) specializing in quantitative asset and risk management. With over 12 years of experience in forex and derivatives markets, he covers MT5 platform optimization, algorithmic trading strategies, and practical insights for retail traders.
Use This Indicator
Risk Disclaimer
Trading financial instruments carries significant risk and may not be suitable for all investors. Past performance does not guarantee future results. This content is for educational purposes only and should not be considered investment advice. Always conduct your own research before trading.