AlgoScriptX
Ehlers MAMA and FAMA lines on a cTrader chart with trend and range shading, cross arrows and the info panel

MESA Adaptive Moving Average (MAMA/FAMA): A cTrader Guide

How John Ehlers' MESA Adaptive Moving Average and FAMA work, why MAMA moves in steps, and cross and regime-filter rules you can test on cTrader.

Short answer: the MESA Adaptive Moving Average (MAMA) is a moving average by John Ehlers that sets its own speed. It measures how fast the phase of the dominant price cycle is changing and turns that into the smoothing factor of an exponential average. Most of the time MAMA moves slowly; about every half cycle it jumps toward price, which gives it a staircase shape. Its companion FAMA follows MAMA at half the speed, so the two lines cross less often than ordinary moving averages. On cTrader the pair serves for crossover rules, trend side and regime filtering, but crosses still lag and can still whipsaw in ranges. Treat every rule here as an idea to test, not as a result.

The theory below follows Ehlers’ original article, “MESA Adaptive Moving Averages”, published in Technical Analysis of Stocks & Commodities in September 2001 (V.19:9, pp. 30–35) and adapted from his book Rocket Science for Traders. Where we describe the cTrader indicator, the details come from its source code.

What is the MESA Adaptive Moving Average?

MAMA starts from an exponential moving average (EMA). Each new EMA value takes a fraction of the current price, called alpha, and the rest from the previous average. A large alpha follows price closely; a small one is smooth but slow. A normal EMA keeps one alpha forever, so its lag never changes.

Adaptive averages change alpha as the market changes. KAMA and VIDYA use volatility for that. Ehlers used the rate at which the phase of the dominant market cycle changes, measured with his Hilbert transform discriminator. MAMA uses the bar’s midpoint, (high + low) / 2, as its price, and the measured cycle is kept between 6 and 50 bars.

How the adaptation works, in plain words

A cycle moves through 360 degrees of phase from start to finish. The shorter the cycle, the faster the phase moves. Ehlers’ own example: a 36-bar cycle advances 10 degrees per bar, a 10-bar cycle 36 degrees per bar.

MAMA sets alpha to the Fast Limit divided by the phase change per bar and never lets it fall below the Slow Limit. With Ehlers’ suggested values of 0.5 and 0.05, a steady 36-bar cycle gives 0.5 / 10 = 0.05. Shorter cycles give even smaller results, which are raised to the Slow Limit. So between its steps MAMA behaves like a slow EMA. Using the usual conversion alpha = 2 / (N + 1), an alpha of 0.05 matches an EMA of about 39 bars.

The second half of the idea sits in the measurement. The arctangent MAMA uses to read the phase only covers half a cycle, from −90 to +90 degrees, so the measured phase snaps back every half cycle. The snap-back looks like a negative phase change, which Ehlers treats as impossible and limits to 1 degree. Alpha then becomes the Fast Limit of 0.5, like a 3-bar EMA, and MAMA moves a large part of the way to price in one bar before slowing down again.

Why MAMA looks like a staircase

Ehlers calls this a fast attack and a slow decay: MAMA jumps toward price, then holds almost flat until the next jump, which draws a staircase behind price. The steps come less often in trends, he notes, because the measured cycle is longer there.

What Fast Limit and Slow Limit change

  • Fast Limit is the largest alpha, used at the steps. Higher values let each step reach closer to price.
  • Slow Limit is the smallest alpha, used between the steps. Higher values make MAMA drift toward price between steps; lower values keep it flatter.
  • If you set the Slow Limit above the Fast Limit, the cTrader indicator clamps it to the Fast Limit.

FAMA and why crosses are rarer

FAMA, the Following Adaptive Moving Average, applies the same averaging to MAMA itself, with half of MAMA’s alpha. It steps at the same moments as MAMA but moves less each time. Because MAMA only ever moves toward price and FAMA only toward MAMA, MAMA cannot cross FAMA while price stays on MAMA’s side of FAMA. A cross needs price to move beyond FAMA, not just beyond MAMA. Ehlers wrote that the lines cross only after a major change in market direction and called the resulting crossover system “virtually free of whipsaw trades”.

Read that as the designer’s intent, not a guarantee. In sideways markets the lines can still cross back and forth, and a cross always comes after the turn. The article’s own example, a long-only test on 100 stocks from 1998 to 2001, had 37.5% winning trades: one old test by the author that says nothing about your symbol, timeframe or costs.

Reading MAMA and FAMA on a cTrader chart

The MAMA Indicator for cTrader on AlgoScriptX uses Ehlers’ published formulas and draws them as an overlay:

  • MAMA is lime while it is above FAMA and orange-red while it is below. FAMA is blue, with a light cloud between the two.
  • An up arrow marks MAMA crossing above FAMA, a down arrow the opposite. With the default Closed Bars Only setting, a cross is only marked once its bar has closed.
  • ATR only places the arrows and measures the MAMA–FAMA gap; it creates no signals.
  • The info panel shows trend side, measured cycle, current alpha and phase. Watching alpha shows the adaptation: it jumps at each step and then falls back.
  • A regime value from −1 to +1 is adapted from Ehlers’ Continuation Index idea (TASC, September 2025), not his exact formula: a low-lag UltimateSmoother is compared with a slower Laguerre filter, and the gap is scaled by its recent size. The panel calls values beyond ±0.5 “trend”, the rest “range”.
  • The optional Regime Gate shows up arrows only while the regime value is above a threshold, and down arrows only while it is below minus the threshold. It is off by default.

Rule ideas to test on cTrader

None of these is a proven strategy. Each is a rule you can write down, test and compare with a simpler baseline.

Rule ideaHow it worksWhat to watch
Plain crossLong when MAMA crosses above FAMA on a closed bar, short on the opposite cross; exit or reverse on the next crossThis is your baseline. Count the trades lost to back-and-forth crosses in ranges
Trend side onlyUse MAMA’s colour as the allowed direction and take entries from your own setup, such as a pullback, only on that sideWhether entries late in a move still pay after costs
Cross plus regime filterSwitch on Regime Gate with threshold 0 (sign only), then raise it in small stepsA filter that removes trades without improving the average trade after costs is not helping
Higher-timeframe confirmationAdd the indicator to a second chart of the same symbol on a higher timeframe and take lower-timeframe crosses only in the direction of the higher MAMA sideUse the last closed higher-timeframe bar; the forming bar can still flip

Exit ideas

  • Opposite cross: simple but slow; it gives back part of the move by design.
  • Close beyond FAMA: usually exits before the cross, with more small exits.
  • Protective stop: beyond the last swing or at a multiple of ATR, with position size calculated from that distance.
  • Time stop: close the trade if it has not moved your way after a fixed number of bars.

Test exits with the same entries, so you know which change made the difference.

How to test MAMA/FAMA rules before you rely on them

  1. Write each rule in one sentence, using closed bars only. If you cannot write it down, you cannot test it.
  2. Collect the raw events. Export Events logs every cross to a CSV file, flagged by whether it passed the Regime Gate, so you can measure what price did next.
  3. Backtest in a cBot. In cTrader, backtesting runs on cBots, not on indicators, so the rules have to live in a cBot. Set realistic spread and commission; our guide on backtesting a cBot before you buy it covers the settings that change results most.
  4. Compare with a baseline: an EMA cross of similar speed, or the same rules with the filter off.
  5. Test several symbols and timeframes, and keep back a period you did not use while choosing settings.
  6. Change Fast Limit and Slow Limit sparingly. Settings tuned until the curve looks perfect rarely hold up.
  7. Forward-test on a demo account before you risk money.

Honest limitations

  • MAMA adapts, but it is still an average. It reacts after price has moved.
  • In choppy markets MAMA and FAMA can cross back and forth, and crosses can come late.
  • The cycle measurement assumes there is a cycle to measure. In noisy, thin or gapping markets it is less reliable, and the measured cycle is clamped to 6–50 bars.
  • The regime value describes the recent past and can turn at any time.
  • Ehlers’ examples used stocks. Nothing in his article covers short forex timeframes, where costs take a larger share of each move.
  • Implementations differ: some use the close or other limits, so two indicators called MAMA may not match.

Trading carries a real risk of loss, and nothing here is investment advice.

Getting started on cTrader

The MAMA Indicator draws lines and arrows and can play a sound alert, but it never places trades. At the time of writing its product page offers a free license. Install the .algo file (see how to install an .algo file in cTrader), add the indicator to a chart and paste your License Key into its parameters. More tools are under cTrader indicators and in the marketplace. Still choosing a platform? Read cTrader vs TradingView; paid TradingView scripts come as invite-only access.

Frequently asked questions

What is the MESA Adaptive Moving Average?

MAMA is John Ehlers’ adaptive exponential moving average from 2001. Its smoothing factor follows how fast the phase of the dominant price cycle changes, so it moves slowly most of the time and catches up with price in steps.

What are good Fast Limit and Slow Limit settings?

Ehlers suggested 0.5 and 0.05, the indicator’s defaults. No setting is best for every market. Change one value at a time and compare with the defaults on data you did not use for tuning.

Is MAMA better than an EMA?

It is different, not automatically better. MAMA’s steps and rarer crosses can mean fewer trades, but also later entries and exits. Test both with the same rules and costs on your symbol.

Does the MAMA indicator repaint?

The cTrader indicator does not recalculate closed bars, but the forming bar changes until it closes. With Closed Bars Only on (the default), arrows appear only after the cross bar has closed; with it off, an arrow on the forming bar can appear and disappear.

Can I trade MAMA/FAMA crosses automatically?

Not with the indicator alone. In cTrader, indicators analyse and draw, while cBots place trades. You would need a cBot that applies the same rules, and you should backtest and demo-test it first.

Sources, checked October 2026: John Ehlers, MAMA – The Mother of Adaptive Moving Averages (author’s copy of the TASC article), the TASC article listing and the cTrader Algo help.

Leave a Reply

Your email address will not be published. Required fields are marked *