Cold MACD by Cryptom
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © cryptom515

//@version=5
indicator('Cold MACD by CrypTom', shorttitle="Cold MACD by CrypTom" , overlay=true)

//Inputs
src = input.source(title = "Source", defval=close)
fa = input(12, title='Ma Length')
sa = input(26, title='Slow Length')
sig = input(9, title='Signal Peroid')
barc = input(defval = false, title = "Show Candle Color")

//Calculation
ma = ta.ema(src, sa - fa)
signal = ta.sma(ma, sig)

//Plot-and-Fill
p1 = plot(signal, color = ma > signal ? color.new(#5fed18, 35) : color.new(#ff0000, 35), style=plot.style_line, linewidth=1, title='Signal')
p2 = plot(ma,     color = ma > signal ? color.new(#5fed18, 35) : color.new(#ff0000, 35), style=plot.style_line, linewidth=1, title='MA')
fill(p1, p2, color = ma > signal ? color.new(#5fed18, 35) : color.new(#ff0000, 35), title='Plots Background')

//Bar-Color
barcolor(barc ? (ma > signal ? color.new(#5fed18, 0) : color.new(#ff0000, 0)) : na, title='Plots Barcolor')


