Reference: Formulas
Vex reference: formulas.
For AI tools: this page as Markdown · the whole language in one file
| Name | What |
|---|---|
if | Picks a value per bar. condition ? a : b is the same. |
starts | What prev(name) reads before there is an earlier bar. |
none | No value (an empty bar, no color). |
and | Both are true. |
or | Either is true. Between texts at the top level, a list of choices for a setting. |
not | The opposite yes/no. |
if
1if condition then a else bPicks a value per bar. condition ? a : b is the same.
In Pine Script: condition ? a : b
Example
1plot(close > open ? high : low)2plot(if close > open then 1 else -1, "Up or down", style = steps)See also: Picking a value: if and ? :
starts
1name starts valueWhat prev(name) reads before there is an earlier bar.
In Pine Script: var x = value
Example
1n starts 02n = new_day ? 0 : prev(n) + 13plot(n, "Bars into the day", style = steps)See also: Values that carry over: starts
none
No value (an empty bar, no color).
In Pine Script: na
Example
1plot(close > open ? close : none, style = dots)See also: Empty values
and
1a and bBoth are true.
Example
1plot(close)2mark(close > open and volume > sma(volume, 20), where = below, shape = dot)or
1a or bEither is true. Between texts at the top level, a list of choices for a setting.
Example
1plot(close)2mark(new_day or crosses_above(close, ema(close, 50)), where = below, shape = dot)not
1not aThe opposite yes/no.
Example
1plot(close)2mark(not (close > open), where = above, shape = dot)

