MACD Histogram

MACD Histogram is an indicator drawn in its own pane.

core language

macd-histogram.abx
1indicator "MACD Histogram"
2pane: new
3
4input fast = 12
5input slow = 26
6input signal_length = 9
7
8m = macd(close, fast, slow, signal_length)
9
10plot m.histogram, style: histogram, color: if m.histogram >= 0 then green.fade(30) else red.fade(30)
11plot m.macd, color: blue
12plot m.signal, color: orange
13hline 0, style: dotted, color: gray
14mark circle, at: below, when: crosses_above(m.macd, m.signal), color: green
What this script says

MACD Histogram is an indicator drawn in its own pane.

You can change 3 inputs: fast (default 12), slow (default 26) and signal_length (default 9).

It calculates m as the MACD (source the close, fast fast, slow slow, signal signal_length).

On the chart, it plots m.histogram, m.macd and m.signal; it also draws a horizontal line at 0; it also marks circle below the bar when m.macd crosses above m.signal.

Try this in the Terminal. AlgoBars is free: $0 a month, no card needed.

Create my free account