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

Viewed 1704

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.

1 Answers

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)
Related