9/26/52 EMA
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © theforlornson

//@version=5
indicator("9/26/52 EMA", overlay=true)


// EMA variables assignment
ema1 = ta.ema(close, 9)
ema2 = ta.ema(close, 21)
ema3 = ta.ema(close, 55)
emaTrend = ta.ema(close, 200)

// 12/26 EMA crossover
emaC1 = ta.ema(close, 12)
emaC2 = ta.ema(close, 26)

//Defining crossovers
bool cUp = ta.crossover(ema2, emaTrend) //and ema1 > ema2 
bool cDown = ta.crossunder(ema2,emaTrend) //and ema1 < ema2 

//Defining macd Crossovers
macdCU = ta.crossover(emaC1,emaC2)
macdCD = ta.crossunder(emaC1,emaC2)

// Drawing the lines
plot(ema1, color=color.green, linewidth=1)
plot(ema2, color=color.orange, linewidth=1)
plot(ema3, color=color.purple, linewidth=1)
plot(emaTrend, color=color.black, linewidth=2)

// Drawing Crossovers
plotshape(cUp ? 1 : na, style=shape.triangleup, color=color.green, location=location.belowbar, size=size.normal)
plotshape(cDown ? 1 : na, style=shape.triangledown, color=color.red, location=location.abovebar, size=size.normal)
plotshape(macdCU ? 1 : na, style=shape.cross, color=color.green, location=location.belowbar, size=size.small)
plotshape(macdCD ? 1 : na, style=shape.cross, color=color.red, location=location.abovebar, size=size.small)

