TAlib v0.3.6 TAlib.Indicators.MACD

MACD indicator Wikipedia Calculate MACD, Signal line, and Histogram

Link to this section Summary

Functions

Calculate MACD Histogram which is (MACD Line - Signal Line)

Parameters

  • prices: List of prices, lates price is the first one in the list.
  • macd_fast: Period of slow ema calculation. Default is 12.
  • macd_slow: Period of fast ema calculation. Default is 26.
  • signal_period: Period of ema calculation on macd line. Default is 9

Calculate Signal line

Link to this section Functions

Link to this function

histogram(prices, macd_fast \\ 12, macd_slow \\ 26, signal_period \\ 9)

Calculate MACD Histogram which is (MACD Line - Signal Line)

Parameters

  • prices: List of prices, lates price is the first one in the list.
  • macd_fast: Period of slow ema calculation. Default is 12.
  • macd_slow: Period of fast ema calculation. Default is 26.
  • signal_period: Period of ema calculation on macd line. Default is 9.

Example

    iex> prices = [1330.95, 1334.65, 1340, 1338.7, ...]
    iex> TAlib.Indicators.MACD.histogram(prices)
    8.082169164564794
Link to this function

macd(prices, fast \\ 12, slow \\ 26)

Calculate MACD

Parameters

  • prices: List of prices, lates price is the first one in the list.
  • fast: Period of slow ema calculation. Default is 12.
  • slow: Period of fast ema calculation. Default is 26.

Example

    iex> prices = [1330.95, 1334.65, 1340, 1338.7, ...]
    iex> TAlib.Indicators.MACD.macd(prices)
    20.36269273502262
Link to this function

signal(prices, period \\ 9)

Calculate Signal line

Parameters

  • prices: List of prices, lates price is the first one in the list.
  • period: Period of ema calculation on macd line. Default is 9.

Example

    iex> prices = [1330.95, 1334.65, 1340, 1338.7, ...]
    iex> TAlib.Indicators.MACD.signal(prices)
    12.280523570457825