Blog / Strategy
Strategy

Mesa Adaptive Trend Shift

Disclaimer: This article is for educational and informational purposes only. It does not constitute financial or investment advice. Trading forex and CFDs carries significant risk of loss. Past performance of any strategy — including backtests — does not guarantee future results. Never trade with money you cannot afford to lose.

What Is This Strategy?

The Mesa Adaptive Trend Shift strategy is a trend-following system built on John Ehlers' MESA Adaptive Moving Average (MAMA) and its slower companion line, FAMA (the Following Adaptive Moving Average). Where most adaptive averages you may have seen — KAMA, VIDYA, FRAMA, Hull, or McGinley — change their smoothing speed based on amplitude cues such as volatility or an efficiency ratio, MAMA takes a fundamentally different route. It measures the market's dominant cycle using a Hilbert-transform quadrature pair and a homodyne discriminator, then adapts its smoothing factor to the rate of change of phase. In plain terms, when price rotates quickly through its cycle (a turning point), the average snaps toward price; when phase drifts slowly (a clean directional run), the average glides smoothly along the trend.

The strategy treats MAMA and FAMA as a self-tuning fast/slow moving-average pair. Because FAMA reacts at half the speed of MAMA, the two lines separate during trends and converge during chop. The Mesa Adaptive Trend Shift strategy reads that separation, filtered through a volatility band, to decide when the market has genuinely shifted from one regime to another — hence the "trend shift" in its name.

This is designed as a learning tool for traders who want to understand cycle-based adaptive filtering and regime detection. It is best suited to liquid, trend-prone instruments — major forex pairs, metals, and stock indices — on intraday-to-swing timeframes. Frame your study of it as a way to explore how phase-driven adaptation behaves in different market conditions, not as a shortcut to a specific outcome.

How It Works

The strategy processes one closed candle at a time, feeding each finished bar into the MESA engine. Here is what happens on every completed bar:

The entry and regime logic then works as follows:

On each confirmed flip:

Because every stop and target is expressed in ATR multiples, the risk frame automatically widens in volatile markets and tightens in calm ones. The strategy also warms up (typically 60 bars) before taking any signal, giving the cycle estimate and the two adaptive lines time to stabilise.

MESA adaptive moving average EA
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
FastLimit 0.50 0.10 0.90 Upper cap on the adaptive smoothing factor. Higher values let MAMA react faster to turns.
SlowLimit 0.05 0.01 0.20 Floor on the smoothing factor. Lower values let MAMA glide more smoothly during trends.
SepAtrMult 0.15 0.00 1.00 Size of the ATR-scaled hysteresis band between MAMA and FAMA. Larger values require a wider separation before a regime flip is accepted, filtering more noise.
AtrPeriod 14 7 40 Lookback length for the Average True Range used in the band, stop, and target.
SlMult 2.0 0.5 6.0 Stop-loss distance as a multiple of ATR.
TpMult 3.0 0.5 10.0 Take-profit distance as a multiple of ATR.
Lots 0.10 0.01 1.0 Fixed trade size in lots.
MESA adaptive moving average EA — MQL5 source code

Recommended Chart Settings

The Mesa Adaptive Trend Shift strategy was designed for liquid, trend-prone instruments such as major forex pairs (for example EUR/USD or GBP/USD), metals like gold, and major stock indices. It runs on whatever primary timeframe you attach it to, and it is intended for intraday-to-swing horizons — timeframes from roughly M15 up to H4 or D1 are reasonable starting points for study.

Because the cycle estimate adapts to the instrument you run it on, no single "best" chart exists. Results will vary considerably across symbols, sessions, and market conditions. Treat any specific chart choice as a starting point for your own testing rather than a fixed recommendation, and always validate behaviour on the exact symbol and timeframe you intend to study.

How to Install on MetaTrader 5

What to Consider Before Using This EA

Strengths. The phase-driven adaptation behind MAMA is genuinely distinct from amplitude-based adaptive averages. In sustained, clean trends the small alpha lets the line glide, which historically helps a trend-follower stay in a move rather than being shaken out by minor pullbacks. The ATR hysteresis band is a thoughtful touch — it is designed to suppress the whipsaw trades that plague simple moving-average crossovers when the two lines hover near each other.

Known limitations. Cycle-measurement techniques assume the market actually has a measurable dominant cycle. In choppy, directionless, or news-driven conditions, the phase estimate can wander, and the strategy may flip regimes more often than the underlying trend justifies. Like all trend-following systems, it can suffer a series of small losing trades during range-bound periods, giving those back to a smaller number of larger trend wins — a pattern that can be psychologically difficult to sit through. The stop-and-reverse behaviour on every flip also means the system is essentially always in the market, which increases exposure to spread and swap costs.

Where it may underperform. Expect weaker behaviour in tight ranges, during low-liquidity sessions, and around scheduled high-impact news, when volatility spikes can trigger flips that quickly reverse. The fixed lot size does not scale with account equity, and the warm-up requirement means it will not trade at all on very short data histories.

Risk Management Tips

Risk Warning

Trading foreign exchange, CFDs, and other leveraged financial instruments involves substantial risk of loss and is not suitable for all investors. The strategies and tools discussed on this page are provided for educational purposes only and do not constitute financial advice, investment recommendations, or solicitation to trade. Always consult a qualified financial adviser before making trading decisions. Past backtest performance is not indicative of future results.

Downloads

← Back to Blog