> ## Documentation Index
> Fetch the complete documentation index at: https://gocharting.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# const, input, simple and series

> The qualifier every value carries, which arguments require which, and the message when a series value goes where a fixed one is needed.

Besides its type, every value has a qualifier that says when it is known. It matters when a function demands a value that cannot
change from bar to bar and you give it one that can.

## The four qualifiers

From weakest to strongest:

| Qualifier | Known | Examples |
| - | - | - |
| `const` | when the script is compiled | `5`, `"Title"`, `color.red`, `10 * 2` |
| `input` | when the user sets the settings | the results of `input.int`, `input.float`, ... |
| `simple` | on the first bar, then fixed | `syminfo.mintick`, `interval.multiplier` |
| `series` | on every bar | `close`, `bar_index`, `talib.sma(close, 5)` |

A value fits a parameter whose qualifier is the same as its own or stronger: a `const` fits every parameter, a `series` only a
`series` one, and an `input` value does not fit a `const` parameter. An expression takes the strongest qualifier of its parts: `10 * 2` is `const`, `input.int(5) * 2` is `input`, `close * 2`
is `series`. `math.floor(x)` keeps the qualifier of `x`.

## Where each is required

* **`const`**: every argument of `indicator()` and `strategy()`; the `title` of `plot`, `plotshape`, `bgcolor`, `hline`,
  `alertcondition` and the other output calls; the default, `title`, `group` and `tooltip` of every `input.*`.
* **`input`**: `plot(linewidth=...)`, `hline(price, ...)`.
* **`series`**: nearly everything else, so `close` can go to `talib.sma`, `label.new` and your own functions, and a moving-average
  length may change from bar to bar.

```lipi-invalid theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Dynamic title")
plot(close, title=str.tostring(close))
```

The compiler says: Cannot call `plot` with argument `title`=`str.tostring(close)`. An argument of `series string` type was used but a `const string` is expected.
The same message, with the other qualifier names, covers every mismatch; the editor's check raises it. A parameter of your own
function may start with `const`, `simple` or `series` (none means `series`; see [Your own functions](https://gocharting.com/docs/scripting/language/custom-functions.md)).
A variable declaration takes no such word: `const int x = 5` is a syntax error.

## A const that becomes series

A variable reassigned inside a `for` or `switch` becomes `series` for the rest of the script, even if every value assigned is a
constant; inside an `if` it takes the qualifier of the condition: under `if true` it stays `const`, under an `input.bool` it is `input`, under `close > open` it is `series`.
So `int width = 1`, then `if close > open { width := 3 }`, then `plot(close, linewidth=width)` fails: Cannot call `plot` with argument `linewidth`=`width`. An argument of `series int` type was used but a `input int` is expected.
`c ? a : b` takes the strongest of `c`, `a` and `b` (`true ? 1 : 2` is `const`; `close > open ? 1 : 2` is `series` and fails the same way).
Use a literal or an `input.int` width, or draw one `plot` per case
with `na` on the bars where it does not apply: `plot(close > open ? close : na, linewidth=3)`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.