Kris
Kris

Reputation: 33

PIne Script - EMA into a 'Checkbox' Boolean input?

sorry for being such a newb and asking this silly question but does anyone know how to turn an EMA into a toggle switch (checkbox) input in TradingView?

Example - having an EMA 200 line drawn unto the chart and having the option to open the settings and toggling it On/OFF with a checkbox.

Upvotes: 3

Views: 2782

Answers (1)

bajaco
bajaco

Reputation: 980

Generally you can click the style tab in the settings menu and turn it off there.

Alternatively you could do the following:

showMA = input(title='Show EMA', type=input.bool, defval=true)

myEMA = ema(close, 200)

plot(showMA ? myEMA : na)

Upvotes: 2

Related Questions