//@version=5
indicator("自己写的MACD指标", "MACD", overlay = false)
fast = input.int(12,"快线")
slow = input.int(24,"慢线")
src = input.source(close,"源值")
signalLength = input.int(9,"信号线长度")
[macd, signal, hist] = ta.macd(src, fast, slow, signalLength)
plot(macd,color=macd>signal ? color.green : color.yellow,linewidth=2)
plot(signal,color=color.fuchsia, linewidth = 2)
plot(hist*2,color= hist>0 ? hist<hist[1]?color.navy:color.blue : hist>hist[1]?color.fuchsia:color.red,style =plot.style_columns)
hline(0,color =color.white, linewidth =1,linestyle = hline.style_dashed)