> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ninjatrader.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ninjatrader.com/_mcp/server.

# Moving Average - Mesa Adaptive (MAMA)

## Description

The MESA Adaptive Moving Average (MAMA) adapts to price movement in an entirely new and unique way. The adaptation is based on the rate change of phase as measured by the Hilbert Transform Discriminator. The advantage of this method of adaptation is that it features a fast attack average and a slow decay average so that composite average rapidly ratchets behind price changes and holds the average value until the next ratchet occurs.

## Syntax

`MAMA(double fastLimit, double slowLimit)`

`MAMA(ISeries\<double\> input, double fastLimit, double slowLimit)`

**Returns MAMA value**

`MAMA(double fastLimit, double slowLimit)[int barsAgo]`

`MAMA(ISeries\<double\> input, double fastLimit, double slowLimit)[int barsAgo]`

**Returns Fama (Following Adaptive Moving Average) value**

`MAMA(double fastLimit, double slowLimit).Fama[int barsAgo]`

`MAMA(ISeries\<double\> input, double fastLimit, double slowLimit).Fama[int barsAgo]`

## Return Value

**double;** Accessing this method via an index value `[int barsAgo]` returns the indicator value of the referenced bar.

## Parameters

| Parameter | Description                                                                                     |
| --------- | ----------------------------------------------------------------------------------------------- |
| fastLimit | Upper limit of the alpha value                                                                  |
| input     | Indicator source data ([Series\<T>](/developer/desktop-sdk/references/common/iseriest/seriest)) |
| slowLimit | Lower limit of the alpha value                                                                  |

## Examples

```csharp
// Prints the current value of a 20 period MAMA using default price type
double value = MAMA(0.5, 0.05).Default[0];
Print("The current MAMA value is " + value.ToString());

// Prints the current value of a 20 period Fama using high price type
double value = MAMA(High, 0.5, 0.05).Fama[0];
Print("The current Fama value is " + value.ToString());
```

## Source Code

You can view this indicator method source code by selecting the menu New > NinjaScript Editor > Indicators within the NinjaTrader Control Center window.