MAMA begins with a four-bar weighted price and smooths it again. A Hilbert transform then splits the smoothed price into an in-phase and a quadrature component, and from those the study measures the phase of the dominant cycle and estimates its period, which in turn scales the filters.
The key quantity is the phase step: the previous bar's phase minus this bar's. A step of one radian or more is treated as zero, and a negative step has a full turn of 2 * pi added. The smoothing constant is fastLimit / (deltaPhase / 0.5) ^ 2, held between the slow and fast limits, so a step of half a radian or less gives the fast limit, a larger step gives a smaller constant, and a step that ran backwards and was wrapped gives a very small constant, the slow limit itself at the default settings. MAMA moves toward price by that constant each bar. FAMA, the following average, moves toward MAMA at half the constant.
The first bar starts both lines at the price, and if the calculation ever loses its value they restart from price on the next bar. The slow limit is never allowed above the fast limit.
How to read MESA Adaptive Moving Average (MAMA)
Read the two lines together. In a move MAMA pulls away from FAMA in the direction of price, and when the move turns MAMA crosses FAMA. That cross is the usual signal, and the gap between the lines shows how far MAMA has run ahead of its follower.
When the measured phase steps are large or run backwards, the smoothing constant falls toward the slow limit and both lines flatten and sit close together, so crosses become rare. A higher fast limit makes MAMA react sooner; a lower slow limit makes both lines flatter while the constant sits at that floor.
Settings
- Source
- The price series the average follows. Close is the usual choice; hl2 or another blend smooths out closes that jump around.
- Fast Limit
- The largest smoothing constant allowed. Higher values let MAMA follow price more closely during fast moves.
- Slow Limit
- The smallest smoothing constant allowed. Lower values make the lines flatter in quiet markets.
Frequently asked questions
What is FAMA?
The following average. It moves toward MAMA with half of MAMA's smoothing constant each bar, so it trails MAMA and the two cross when the trend turns.
Why do the lines go flat at times?
When the phase step is between half a radian and one radian, or runs backwards, the smoothing constant drops, down to the slow limit, and both lines barely move until the phase steps shrink again.
What happens if the slow limit is set above the fast limit?
It is held at the fast limit, so the smoothing constant is fixed at that value and the line stops adapting.
