Skip to main content
Lipi is GoCharting’s own scripting language. A script runs once for every bar of the chart and puts its results back on that chart: lines, marks, drawings, tables, alerts and, for a strategy, a simulated trading record. This is the manual for Lipi v2, which runs in Terminal V2; the Classic Terminal runs scripts written for Lipi v1.

Indicator or strategy

A script declares what it is, once, with indicator(...) or strategy(...).
  • An indicator calculates values and shows them. See Script anatomy.
  • A strategy does the same and also places orders with strategy.entry, strategy.close and the other strategy.* calls. The orders are simulated: they fill against the chart’s own bars on an account inside the script engine, so a strategy is a backtest. No function in the language sends an order to a broker. To hand a signal to another system, use alerts and webhooks (see Alerts and Webhooks for algo trading). See Strategies and backtesting.

The first line

Every Lipi v2 script starts with //@lipi=2. It selects the language version. A script without it is read as Lipi v1, an older version with a smaller set of names and other rules (see Moving a script from Lipi v1 to v2). The smallest complete script declares itself and plots one value:

What a script can produce

What a script cannot do

These limits are enforced by the compiler.
  • Read another symbol or another interval. There is no request namespace; a script sees the symbol and interval of the chart it runs on (see Instrument properties and Sessions and intervals).
  • Send an order to a broker. Strategy orders exist only inside the simulation.
  • Look back more than 500 bars. close[501] stops the script when it runs.
  • Load other code. There is no import, and library() is not available.
  • Use maps or matrices. Collections are arrays.
  • Keep an unlimited number of drawings. Each kind has a limit, 50 by default (see Limits).

Where to start

Why Lipi exists

where the language comes from and how it is defined.

Write your first script

a working indicator in a few lines.

The Lipi editor

how a script is checked, and what a clean check does not prove.

Reading someone else's script

how to find your way in a script you did not write.

Names and conventions

the Lipi spelling of what other languages call differently.

What Lipi does not do

names and forms that do not exist, and what to write instead.

Moving a script from Lipi v1 to v2

the header, what v2 adds and what to check.

The reference

every function, variable, constant and keyword.

Tutorials

build one complete script step by step.