ndt Bull & Bear
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © doinguoilacloi

//@version=5
indicator(title="Indicator", shorttitle="ndt Bull & Bear", overlay=true)
ema9 = ta.ema(close, 9)
ema21 = ta.ema(close, 21)
ema50 = ta.ema(close, 50)
ema200 = ta.ema(close, 200)
p1=plot(ema9, title = "HMA9", color = color.new(color.lime,0), linewidth=2)
p2=plot(ema21, title = "HMA21", color = color.new(color.orange,0), linewidth=2)
p3=plot(ema50, title = "HMA50", color = color.new(color.blue,0), linewidth=2)
p4=plot(ema200, title = "HMA200", color = color.new(color.red,0), linewidth=2)

cloudcolor9_21 = ema9 > ema21 ? color.green : color.red
cloudcolor21_50 = ema21 > ema50 ? color.white : color.maroon

fill(p1, p2, color = color.new(cloudcolor9_21, 50), title = "HMA Cloud 9&21")

fill(p3, p4, color = color.new(cloudcolor21_50, 50), title = "HMA Cloud 21&50")

//plotshape(ta.crossover(ema9,ema21), title = "Bull", style=shape.triangleup, size=size.small,location=location.belowbar, color=color.new(color.green,0), text="Mua", textcolor=color.new(color.green,0))
//plotshape(ta.crossunder(ema9,ema21), title = "Bear", style=shape.triangledown, size=size.small,location=location.abovebar, color=color.new(color.red,0), text="Bán", textcolor=color.new(color.red,0))