50 EMA - Multi 1D 4H 1H
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © rrchico

//@version=5
indicator("50 EMA - Multi 1D 4H 1H", overlay=true, timeframe="60")

//inputs
plot1DVisibility = input.bool(true, "50D Visible")
plot1Dcolor = input.color(color.yellow, title="5DD EMA")
plot4HVisibility = input.bool(true, "50 4H Visible")
plot4Hcolor = input.color(color.lime, title="50 4H EMA")
plot1HVisibility = input.bool(true, "50 1H Visible")
plot1Hcolor = input.color(color.fuchsia, title="50 1H EMA")

source = close
emaLength = 50

ema50D = ta.ema(source, 24 * emaLength)
ema504H = ta.ema(source, 4 * emaLength)
ema50 = ta.ema(source, emaLength)

out50dLength = request.security(syminfo.tickerid, "60", ema50D)
out504hLength = request.security(syminfo.tickerid, "60", ema504H)
out501hLength = request.security(syminfo.tickerid, "60", ema50)


out50dDisplay = display.all
out504hDisplay = display.all
out501hDisplay = display.all

if plot1DVisibility == false
    out50dDisplay := display.none
if plot4HVisibility == false
    out504hDisplay := display.none
if plot1HVisibility == false
    out501hDisplay := display.none

ema50dPlot = plot(out50dLength, color=plot1Dcolor, title="50D EMA", display = out50dDisplay)
ema504hPlot = plot(out504hLength, color=plot4Hcolor, title="50 4H EMA", display = out504hDisplay)
ema501hPlot = plot(out501hLength, color=plot1Hcolor, title="50 1H EMA", display = out501hDisplay)