Skip to main content
Lipi is GoCharting’s own scripting language. It exists so that you can put your own calculations on a GoCharting chart, as an indicator or as a strategy, in a language that GoCharting defines, checks and maintains with the platform.

A small language

Lipi keeps its surface small. A statement is one line. A block is written with braces over several lines. A script declares what it is with one call, indicator(...) or strategy(...), and the platform evaluates it once for every bar. What the script produces (plots, drawings, tables, alerts, strategy orders) goes through a fixed set of calls, listed in the reference.

How the language is defined

Lipi is defined by an ANTLR grammar and implemented in Go, in GoCharting’s own codebase. The grammar decides what parses. The compiler decides which parsed scripts are accepted, and the interpreter decides what they do when they run. All three are maintained together with the platform, so a name in the language is a name in GoCharting’s compiler.

Versions

Lipi has two versions. The first line of a script selects one: //@lipi=2 selects Lipi v2, and a script without the line is read as Lipi v1. Lipi v2 adds arrays, drawings, tables and strategies, and the editor checks a script against the rules of the version it selects. This manual describes Lipi v2; see Moving a script from Lipi v1 to v2 for what changes.

What this manual describes

This manual describes the language as the compiler implements it. Where the manual and the compiler differ, the compiler is right and the manual has a bug. Pages say which phase enforces a rule: the editor’s check, adding the script to the chart, or running the script (see The Lipi editor). The reference lists every function, variable, constant, type and keyword; the manual explains how they fit together. The smallest complete script declares itself and plots one value: