EMA x5
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Gabriel-Tan
//Edited to 3 EMAs

//@version=5
indicator(title='EMA x5', shorttitle='EMA x5', overlay=true)

shownormalEMA = input.bool(title="Show normal EMA's?", defval=false)
showHTFEMA = input.bool(title="Show HTF EMA's?", defval=true)

var reso                    = "Higher Timeframe Resolutions"
reso1                       = input.timeframe(title='Trend Condiiton Timeframe 1 (Base Timeframe)', defval='240', group=reso)
reso2                       = input.timeframe(title='Trend Condiiton Timeframe 2 (Comparing Timeframe)', defval='480', group=reso)
reso3                       = input.timeframe(title='Trend Condiiton Timeframe 3 (Optional Timeframe)', defval ='720', group=reso)
reso4                       = input.timeframe(title='Trend Condiiton Timeframe 4 (Optional Timeframe)', defval ='D', group=reso)

EMA1 = ta.ema(close, input(title='EMA1:', defval=5))
EMA2 = ta.ema(close, input(title='EMA2:', defval=20))
EMA3 = ta.ema(close, input(title='EMA3:', defval=50))
EMA4 = ta.ema(close, input(title="EMA4:", defval=100))
EMA5 = ta.ema(close, input(title="EMA5:", defval=200))

ema50Smooth4hours = request.security(syminfo.tickerid, reso1, EMA3, gaps=barmerge.gaps_on)
ema50Smooth8hours = request.security(syminfo.tickerid, reso2, EMA3, gaps=barmerge.gaps_on)
ema50Smooth12hours = request.security(syminfo.tickerid, reso3, EMA3, gaps=barmerge.gaps_on)

plot(shownormalEMA ? EMA1 : na, color=color.new(color.red, 0), title='EMA 1')
plot(shownormalEMA ? EMA2 : na, color=color.new(color.green, 0), title='EMA2')
plot(shownormalEMA ? EMA3 : na, color=color.new(color.orange, 0), title='EMA3')
plot(shownormalEMA ? EMA4 : na, color=color.new(color.aqua, 0), title="EMA4")
plot(shownormalEMA ? EMA5 : na, color=color.new(color.fuchsia, 0), title="EMA5")

plot(showHTFEMA ? EMA3 : na, color=color.new(color.red, 0), title="Current EMA 50", linewidth=2)
plot(showHTFEMA ? ema50Smooth8hours : na, color=color.new(color.aqua, 0), title="Resolution 2 EMA 50")
plot(showHTFEMA ? ema50Smooth12hours : na, color=color.new(color.fuchsia, 0), title="Resolution 3 EMA 50")

