indicator · own pane · open source
MACD Histogram
Running…
Loading chart…
About
MACD Histogram alone — the gap between MACD and its signal line, plotted as columns. Bar colour flips are the momentum-shift alerts.
- Positive columns = bullish momentum building.
- Shrinking bars = momentum weakening.
- Pair with MACD/Signal for full context.
Source code
//@version=5
indicator("MACD Histogram", overlay=false)
fast = input.int(12, "Fast Length", minval=2, maxval=100)
slow = input.int(26, "Slow Length", minval=2, maxval=200)
sig = input.int(9, "Signal Length", minval=2, maxval=50)
src = input.source("close", "Source")
[m, s, h] = ta.macd(src, fast, slow, sig)
hline(0, "Zero", color=color.gray, linestyle=hline.style_dotted)
p_Histogram = plot(h, "Histogram", color=h >= 0 ? color.green : color.red, style=plot.style_columns)
alertcondition(ta.crossover(h, 0), "Histogram crosses zero up", "MACD histogram turned positive")
alertcondition(ta.crossunder(h, 0), "Histogram crosses zero down", "MACD histogram turned negative")
No comments yet.
Sign in to comment.