TAlib.Indicators.MAMA (TAlib v0.13.0)

Copy Markdown View Source

MESA Adaptive Moving Average (TA-Lib MAMA), translated from the TA-Lib C reference implementation of John Ehlers' MESA machinery.

The alpha of the exponential average adapts to the phase rate of the Hilbert-transformed price: it moves at fast_limit when the phase rate is at or below one degree per bar (trending) and slows toward slow_limit as the phase rate rises. fama is MAMA itself averaged again with half the alpha.

Like TAlib.Indicators.HT (the 32-lookback family: ht_dcperiod, ht_phasor), the first 32 entries are nil; TA-Lib's configurable unstable-period machinery is not mirrored. See TAlib for the conventions.

Summary

Functions

Calculate the MAMA and FAMA series as a map.

Functions

mama(prices, fast_limit \\ 0.5, slow_limit \\ 0.05)

@spec mama([number()], number(), number()) :: %{
  mama: [float() | nil],
  fama: [float() | nil]
}

Calculate the MAMA and FAMA series as a map.

Parameters

  • prices: list of prices, oldest first.
  • fast_limit: maximum alpha, between 0.01 and 0.99 (default 0.5).
  • slow_limit: minimum alpha, between 0.01 and 0.99 (default 0.05).

Examples

iex> values = TAlib.Indicators.MAMA.mama(Enum.to_list(1..100))
iex> Float.round(List.last(values.mama), 4)
95.7327