# Settings

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

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 write | The setting is |
| --- | --- |
| `length = 14` | a whole number |
| `mult = 2.5` | a decimal |
| `source = close` | a price dropdown: close, open, high, low, hl2, hlc3, ohlc4 |
| `smooth = true` | a checkbox |
| `average = "ema" or "sma"` | a dropdown; the first is the default |
| `col = blue` | a 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 write | The 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 |

```vex
length = int(20, "Length", min = 2, max = 200)
mult = float(2, "Width", min = 0.5, max = 5, step = 0.25)
src = source(close, "Price")
average = string("ema" or "sma", "Average")

b = bands(src, length, mult)
plot(b.upper, "Upper")
plot(average == "ema" ? ema(src, length) : sma(src, length), "Average")
plot(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](/documentation/vex/reference/settings#int), [float](/documentation/vex/reference/settings#float), [string](/documentation/vex/reference/settings#string), [source](/documentation/vex/reference/settings#source), [color](/documentation/vex/reference/settings#color)
