ege mynet
ege mynet

Reputation: 17

I can't use input.bool command in pine script V5

I cannot use the input.bool command in pine script V5. If the input is true, the following commands will work or not, how can I do it?

bak = input.bool(true, title="True or False")

len = input.int(defval=13, minval=1, title="Length", group='Ema', confirm=false)
src = input(close, title="Source", group='Ema')
offset = input.int(title="Offset", defval=0, minval=-500, maxval=500, group='Ema')
out = ta.ema(src, len)
plot(out, title="EMA 13", color=color.blue, offset=offset, linewidth=2)

Upvotes: 0

Views: 956

Answers (1)

vitruvius
vitruvius

Reputation: 21139

You can apply your conditon to the series parameter of plot().

plot(bak ? out : na, title="EMA 13", color=color.blue, offset=offset, linewidth=2)

Upvotes: 1

Related Questions