How to group and lay out your inputs
Every input takes the same four presentation arguments beyond its value and title.
| Argument | Does |
|---|---|
group | puts the control under a heading of that name |
inline | puts controls sharing the key on one row |
tooltip | attaches help text to the control |
confirm | asks the reader to confirm the value |
All four are const, so none can be built from series data. Give the same
group string to several inputs and they sit together; give the same inline
key to two inputs and they share a row.
indicator("Grouped inputs", "grp", true)
src = input.source(close, "Source", inline = "calc", group = "Calculation")
length = input.int(20, "Length", 1, 200, 1, "Bars in the average", "calc", "Calculation")
up = input.color(color.green, "Rising", group = "Appearance")
down = input.color(color.red, "Falling", group = "Appearance")
float average = talib.sma(src, length)
plot(average, title = "Average", color = close > close[1] ? up : down)Why one of those calls is written positionally
step cannot be named. It is a word the grammar reserves for counted loops, so
step = 1 is a parse error. In input.int and input.float it sits fifth, so
everything up to and including it goes by position.
input.int(const int defval, const string title, const int minval, const int maxval, const int step, const string tooltip, const string inline, const string group, const bool confirm) → input intThat is why the input.int line above passes eight arguments in order:
default, title, minimum, maximum, step, tooltip, inline key, group. Every other
input function has no step, so name its arguments freely.
If you want a step and no bounds, pass na for the two bounds. Those three are
the only input arguments that accept na.
The failure to watch for
Naming step is the commonest cause of a compile failure. If an input line
will not parse, check that first.
See Inputs.