public MAMA(DataSeries source, double FastLimit, double SlowLimit, string description)
public static MAMA Series(DataSeries source, double fastLimit, double slowLimit)
||The maximum alpha value
||The minimum alpha value
MAMA stands for MESA Adaptive Moving Average. It was developed by John Ehlers of Mesa Software, and presented in the September 2001 issue of Stocks & Commodities magazine. MAMA is an adaptive exponential moving average. The EMA's alpha (α) is related to the phase rate of change (the degree to which the phase of the market cycle changes from bar to bar).
In addition to Price Series, MAMA accepts two additional parameters, FastLimit and SlowLimit. These control the maximum and minimum alpha (α) value that should be applied to the most recent bar of data when calculating MAMA.
You can learn more about the Mesa Adaptive Moving Average at the Mesa Software web site
- MAMA is a type of moving average. You can use the it in place of any other moving average, and apply the same interpretations, such as price crossovers, crossovers of short and long period averages, etc. MAMA crossovers typically exhibit fewer whipsaws than traditionally moving averages.
- MAMA is also used in conjunction with its complimentary FAMA indicator. Trading signals occur when MAMA crosses over and under FAMA.
MAMA = α * Price + ( 1 - α ) * MAMAPrevious
This is a typical exponential moving average calculation. The difference is that the alpha value changes bar by bar, and is based on the following formula:
α = FastLimit / DeltaPhase
DeltaPhase is the rate of change of the Hilbert Transform homodyne discriminator. The alpha value is kept within the range of FastLimit and SlowLimit.
public class MyStrategy : WealthScript
protected override void Execute()
DataSeries hMA = MAMA.Series( Close, 0.5, 0.05 );
DataSeries hFA = FAMA.Series( Close, 0.5, 0.05 );
PlotSeries( PricePane, hMA, Color.Red, WealthLab.LineStyle.Solid, 1 );
PlotSeries( PricePane, hFA, Color.Blue, WealthLab.LineStyle.Solid, 1 );
for(int bar = hMA.FirstValidValue; bar < Bars.Count; bar++)
if( CrossOver( bar, hMA, hFA ) )
BuyAtMarket( bar+1 ); else
if( CrossOver( bar, hFA, hMA ) )
SellAtMarket( bar+1, LastPosition );