SutraLipi docs grammar v1

Types & variables

Primitive types are int, float, bool, string, datetime and color.

int      period = 14;
float    price  = 100.5;
bool     active = true;
string   note   = "entry";
datetime start  = '2026-07-30 09:15';
color    up     = #00ff00;

Constants

A const must be initialised and cannot be reassigned.

const int MAX_QTY = 5;

Arrays

Declare an array with type[]. Indicators fill arrays; you can also initialise one with a list. Index with [i].

float[] sma;                    // declared, filled later by an indicator
int[]   levels = [100, 200, 300];

int first = levels[0];          // index access — [0] is the first element

Ready to run this? Build and backtest strategies in the SutraLipi algo trading platform — no-code builder, tick-level backtesting and one-click live execution. Browse all documentation topics.

Code copied — paste it into the editor with Ctrl+V.