input.* reference
Each input.* declaration renders a control in the editor’s Inputs panel; changing a value re-runs the script. The general shape is input.<kind>(default, title?, …).
input.num
input.num(default, title?, min:, max:) → number
A numeric input — renders as a number field (with optional min/max bounds).
| default | number | Initial value. |
| title | text? | Label shown in the Inputs panel. |
| min / max | number? | Named bounds, e.g. `min: 2, max: 200`. |
Returns: number
pulse 1
len = input.num(20, "Length", min: 2, max: 200)
draw line(sma(close, len), title: "SMA")
input.source
input.source(default) → series
A price-series picker — lets the user choose close / open / high / low / hl2 / hlc3 / etc.
| default | series | Default price series, e.g. `close`. |
Returns: price series
pulse 1
src = input.source(close)
draw line(ema(src, 20), title: "EMA of source")
input.bool
input.bool(default, title?) → bool
A toggle switch.
| default | bool | Initial on/off. |
| title | text? | Label. |
Returns: bool
pulse 1
showMarks = input.bool(true, "Show signals")
when showMarks and crossOver(ema(close, 9), ema(close, 21)): mark buy at low "Long"
input.text
input.text(default, title?) → text
A free-text input — handy for custom mark/alert labels.
| default | text | Initial string. |
| title | text? | Label. |
Returns: text
pulse 1
label = input.text("Long", "Buy label")
when crossOver(ema(close, 9), ema(close, 21)): mark buy at low label
input.select
input.select(default, title?, options: [...]) → text
A dropdown of fixed choices.
| default | text | Default option (must be in the list). |
| title | text? | Label. |
| options | text[] | Named list of choices, e.g. `options: ["fast", "slow"]`. |
Returns: text (the chosen option)
pulse 1
mode = input.select("fast", "Mode", options: ["fast", "slow"])
len = mode == "fast" ? 9 : 21
draw line(ema(close, len), title: "EMA")
input.color
input.color(default, title?) → color
A colour picker — feed the result into any output’s `color:` argument.
| default | color | Default colour string, e.g. `"#38bdf8"`. |
| title | text? | Label. |
Returns: color string
pulse 1
col = input.color("#38bdf8", "Line colour")
draw line(sma(close, 20), color: col, title: "SMA")