TAlib v0.3.3 TAlib.Indicators.MA

Moving Average indicator Wikipedia Calculate SMA, WMA, and EMA

Link to this section Summary

Functions

Calculate Cumulative Moving Average

Calculate Exponential Moving Average

Calculate Simple Moving Average

Calculate Weighted Moving Average

Link to this section Functions

Link to this function

cma(prices, period \\ 50)

Calculate Cumulative Moving Average

Parameters

  • prices: List of prices, lates price is the first one in the list.
  • period: MA period to be calculated. It must be less than size of prices

Example

  iex> TAlib.Indicators.MA.cma([0,1,2,3],3)
  2.0
Link to this function

ema(prices, period \\ 50)

Calculate Exponential Moving Average

Parameters

  • prices: List of prices, lates price is the first one in the list.
  • period: MA period to be calculated. It must be equal or less than size of prices

Example

  iex> TAlib.Indicators.MA.ema([0,1,2,3],3)
  1.0
Link to this function

sma(prices, period \\ 50)

Calculate Simple Moving Average

Parameters

  • prices: List of prices, lates price is the first one in the list.
  • period: MA period to be calculated. It must be equal or less than size of prices

Example

  iex> TAlib.Indicators.MA.sma([1,2,3],3)
  2.0
Link to this function

wma(prices, period \\ 50)

Calculate Weighted Moving Average

Parameters

  • prices: List of prices, lates price is the first one in the list.
  • period: MA period to be calculated. It must be equal or less than size of prices

Example

  iex> TAlib.Indicators.MA.wma([0,1,2,3],3)
  2.3333333333333335