Sidechair

Pine Script keywords

Browse the reference

23 keywords for declarations, loops and logic.

Open the Pine Editor

and
Logical AND: a and b is true only when both are true, and in v6 b is not evaluated when a is already false.
as
Gives an imported library a short name: import user/library/1 as lib makes lib.function() available.
break
Leaves the nearest enclosing for, for...in or while loop immediately.
by
Sets the step of a for loop: for i = 0 to 100 by 25 counts 0, 25, 50, 75, 100.
continue
Skips the rest of the current pass of a loop and moves on to the next one.
else
The fallback branch of an if: it runs when no earlier condition held, and can be written else if to chain tests.
enum
Declares an enumeration: a fixed set of named values whose titles can drive input.enum dropdowns.
export
Marks a function, method, type or enum in a library so that scripts importing the library can use it.
for
Repeats a block with a counter that runs from a start value to an end value in steps, both ends included.
for...in
Loops over every element of an array, or every key-value pair of a map, with an optional index.
if
Runs a block only when a condition is true, with optional else if and else branches, and returns the value of the branch it ran.
import
Brings a published library into a script under an alias, written import user/library/version as alias.
in
Joins an item to the collection it is read from in a for...in loop: for item in array.
method
Declares a function that is called with dot syntax on a value of its first parameter's type, and may be overloaded per type.
not
Logical negation: not x is true when x is false, and false when x is true.
once
A Pine v6 statement form, once [condition] followed by an indented block, that Sidechair does not run yet.
or
Logical OR: a or b is true when either is true, and in v6 b is not evaluated when a is already true.
switch
Picks one block to run: by matching a value against cases, or by testing conditions in order; the result is the chosen block's value.
to
Separates the first and last value of a for loop: for i = 1 to 10 counts from 1 through 10.
type
Defines a user-defined type: a named set of typed fields that you create instances of with TypeName.new().
var
Declares a variable that is set once, on the first bar, and then keeps its value from bar to bar until you reassign it.
varip
Declares a variable that persists across bars and, unlike var, keeps its changes between ticks of the live bar.
while
Repeats a block for as long as a condition stays true, checking the condition before each pass.