Each section below gives the Lipi construct first, then the construct in each language, with a note wherever behaviour differs. The language name links to the documentation the row was checked against.
Bar-by-bar evaluation
The script body runs once for every bar, oldest first, and then again as the live bar updates. In Lipi this is written with the language’s own syntax. A closed bar runs once. A forming live bar reruns on every tick only if calc_on_every_tick is true; those reruns do not advance history.Declare an indicator
A statement that names the script as an indicator and sets its display options. In Lipi:indicator. title is the only required argument. The call must be at top level. Title and shorttitle max 128 characters, checked on Add to chart.
Declare a strategy
A statement that names the script as a strategy and sets its simulation options. In Lipi:strategy. No slippage, currency or margin arguments. default_qty_type is an unchecked string; only strategy.fixed exists as a constant, “cash” and “percent_of_equity” are strings.
Price pane or own pane
Whether the script draws on the price chart or in a separate pane below it. In Lipi:indicator. Default is overlay=false (own pane). force_overlay=true on a plot, label or box puts it on the price pane; line.new spells it forceOverlay.
Recalculate on every update
Whether the live bar is recalculated on each price update or only when the bar closes. In Lipi:indicator, barstate.isconfirmed. Indicator default is calc_on_every_tick=true, strategy default false. An indicator with false is skipped on every unconfirmed bar.
Language version header
A line at the top of the file that selects which version of the language compiles the script. In Lipi:@lipi=. //@lipi=2 is required on the v2 stack. The first match anywhere in the file counts; case and spaces around = are free.
Basic value types
Whole numbers, decimal numbers, true/false values, text and colours. In Lipi:int, float, bool, string, color. Colour literals are #RRGGBB or #RRGGBBAA, alpha last. No hex numbers or digit separators; string escapes such as \n are not translated.
Missing value
A value that stands for “no value on this bar”, and the functions that test for it or replace it. In Lipi:na, nz, fixnan. Arithmetic with na gives na, as does division or modulo by zero. and/or do not short-circuit, and na and false is na.
Value qualifiers
Markers that say whether a value is fixed at compile time, fixed after the first bar, or may change on every bar. In Lipi:const, simple, series. const fits any parameter, series only a series one. Titles must be const, linewidth input. Reassigning inside if, for or switch makes a variable series.
Type conversion
Turning a value of one type into another, such as a decimal into a whole number or a number into text. In Lipi:int, float, bool, str.tostring, str.tonumber. int() truncates toward zero; casts take numbers only. + does not join a string and a number: use str.tostring.
Declare and assign a variable
Giving a name to a value, and giving the name a new value later. In Lipi this is written with the language’s own syntax.= declares, := assigns. A variable keeps the type of its first value (x = 0 is an int); na cannot start an untyped variable.
Your own enumeration
A named set of fixed options declared by the script. In Lipi:enum. One member per line; no one-line form. Read a member as Name.A. An enum cannot be passed to str.tostring.
Your own object type
A named group of fields declared by the script, with objects created from it. In Lipi:type. A field default is a literal, na or a built-in variable. Assigning an object (q = p) shares it; Pt.copy(p) makes a shallow copy.