Whole numbers, decimals, colours, price sources, choices and more, with groups and tooltips.
//@version=6
indicator("Inputs Demo", overlay = true)
length = input.int(20, "Length", minval = 1, maxval = 500, tooltip = "How many bars to average", group = "Average")
source = input.source(close, "Source", group = "Average")
kind = input.string("EMA", "Type", options = ["SMA", "EMA", "WMA"], group = "Average")
lineColor = input.color(color.orange, "Line colour", group = "Style")
width = input.int(2, "Line width", minval = 1, maxval = 5, group = "Style")
showBands = input.bool(false, "Show bands", group = "Style")
ma = switch kind
"SMA" => ta.sma(source, length)
"WMA" => ta.wma(source, length)
=> ta.ema(source, length)
plot(ma, "Average", lineColor, width)
dev = ta.stdev(source, length)
plot(showBands ? ma + dev : na, "Upper", color.new(lineColor, 50))
plot(showBands ? ma - dev : na, "Lower", color.new(lineColor, 50))