macd_histogram

MACD Histogram (MACD line - Signal line)

macd_histogram(source, fast_period, slow_period, signal_period, fast_matype="ema", slow_matype="ema", matype="ema")

Parameters

MACD Histogram - macd_histogram(source, fast_period, slow_period, signal_period, fast_matype="ema", slow_matype="ema", matype="ema")

Difference between MACD line and signal. Visualizes momentum strength.

  • source (field): Data series (commonly close)
  • fast_period (int): Fast MA period (commonly 12)
  • slow_period (int): Slow MA period (commonly 26)
  • signal_period (int): Signal period (commonly 9)
  • fast_matype (str, optional): Fast MA type ["ema", "sma", "wma"], default "ema"
  • slow_matype (str, optional): Slow MA type ["ema", "sma", "wma"], default "ema"
  • matype (str, optional): Signal MA type ["ema", "sma", "wma"], default "ema"

Formula


Histogram = MACD Line - Signal Line

Examples


// histogram positive (MACD above signal, bullish)
macd_histogram(close, 12, 26, 9) > 0;

// histogram increasing (momentum strengthening)
macd_histogram(close, 12, 26, 9) > macd_histogram(close, 12, 26, 9)[1];

// histogram crossed zero (MACD crossed signal)
crossover(macd_histogram(close, 12, 26, 9), 0);

Returns

Float (positive = bullish, negative = bearish)

See Also