I am not an expert. I wrote an simple code that plots ema based on condition. If intraday is true then value of ema is 9 or value of ema is 21. But there is error on "out = ta.ema(src, len)" there is a red line below len and says that "Undeclared identifier len". can someone guide how to solve this.
//@version=5
indicator(title="Moving Average Exponential", shorttitle="EMA", overlay=true)
intraday=input(defval=true, title="INTRADAY / STANDARD")
if (intraday == true)
len = input.int(9, title="Length")
else
len = input.int(21, title="Length")
src = input(close, title="Source")
out = ta.ema(src, len)
plot(out, title="EMA", color=color.blue)