Standard MACD with zero line added
study(title="Moving Average Convergence/Divergence", shorttitle="MACD") source = close fastLength = input(12, minval=1), slowLength=input(26,minval=1) signalLength=input(9,minval=1) fastMA = ema(source, fastLength) slowMA = ema(source, slowLength) macd = fastMA - slowMA signal = sma(macd, signalLength) hist = macd - signal h0 = hline(0) plot(hist, color=red, style=histogram) plot(macd, color=blue) plot(signal, color=orange)