Settings

A plain value at the top is a setting; int(), float() and friends add a label and limits.

For AI tools: this page as Markdown · the whole language in one file

Any top-level name set to a plain value becomes a setting in the chart's settings dialog, labelled from its name (fast_length shows as "Fast length"). There is no input keyword.

You writeThe setting is
length = 14a whole number
mult = 2.5a decimal
source = closea price dropdown: close, open, high, low, hl2, hlc3, ohlc4
smooth = truea checkbox
average = "ema" or "sma"a dropdown; the first is the default
col = bluea color picker

To give the type, a label or limits, write a typed input instead, still alone at the top. The label, min, max and step are all optional; min, max and step are for int and float.

You writeThe setting is
length = int(14, "RSI length", min = 2, max = 200)a whole number: the dialog keeps it whole
mult = float(2, "Band width", min = 0.5, step = 0.25)a decimal, even starting at a whole number
smooth = bool(true, "Smooth it")a checkbox
average = string("ema" or "sma", "Average")a dropdown of text (always text, even "high" or "low")
src = source(close, "Price")a price dropdown (source("close" or "hl2") offers just those)
col = color(blue, "Line color")a color picker
1length = int(20, "Length", min = 2, max = 200)2mult = float(2, "Width", min = 0.5, max = 5, step = 0.25)3src = source(close, "Price")4average = string("ema" or "sma", "Average")5 6b = bands(src, length, mult)7plot(b.upper, "Upper")8plot(average == "ema" ? ema(src, length) : sma(src, length), "Average")9plot(b.lower, "Lower")
  • A number used as a length or a prev count is kept between 1 and 5000 automatically.
  • A saved value outside the limits (from an older version of the script) is used at the nearest limit.
  • These words make settings only. Inside a formula, Pine's int(x) is round(x), floor(x) or ceil(x).
  • Every plotted line also gets color and width settings on the Style tab, and every fill an opacity.

See also: int, float, string, source, color