I want to plot some EMAs only if a input is true.. however when i use the if functions, it says "Cannot use 'plot' in local scope."
//@version=4
study(title = "Todos os indicadores", overlay = true)
showemas = input(false, title = "Show EMAs")
if showemas == true
plot(ema(close, length1), color=#F44336, linewidth=2, title="EMA 1")
plot(ema(close, length2), color=#4CAF50, linewidth=2, title="EMA 1")
plot(ema(close, length3), color=#673AB7, linewidth=2, title="EMA 1")
plot(ema(close, length4), color=#2196F3, linewidth=2, title="EMA 1")
plot(ema(close, length5), color=color.white, linewidth=2, title="EMA 1")
plot(sma(close, length6), color=color.orange, linewidth=2, title="EMA 1")
Aucun commentaire:
Enregistrer un commentaire