Is it possible to group together plots in pine editor?

151 Views Asked by At

I have an indicator that has an 8 sma ribbon and 4 other MAs. Is it possible to divide these into two groups with check boxes in the settings dialog box so I can hide the ribbon so my charts don't look cluttered? I'm new to coding, any help is appreciated.

showRibbon = input.bool(true, 'Ribbon') 
showEmas = input.bool(true, 'EMAs') 
Ribbon = ta.sma(ohlc4,len1, len2, len3, len4, len5, len6, len7, len8) 
EMAs = ta.ema(ohlc4,len9, len10, len11, len12)
1

There are 1 best solutions below

6
AmphibianTrading On

Yes this is doable. You can turn each on or off in the indicator settings. See example.

//@version=5
indicator("My script", overlay = true)
showRibbon = input.bool(true, 'Show Ribbon')
showEmas = input.bool(true, 'Show Emas')

fakeRibbon = ta.sma(close,50)
EMA1 = ta.ema(close,21)

plot(showRibbon ? fakeRibbon : na, color= color.blue)
plot(showEmas ? EMA1 : na, color = color.green)