SutraLipi docs grammar v1

Overview

A program is a list of statements: declare symbols and variables, then react to the market inside event blocks such as onTick. Indicators write their output into an array; index [0] is the current candle, [1] the previous one.

EquitySymbol niftyBank = NSE:IDX:"NIFTY BANK";
float[] rsi;

onTick {
    // fill the rsi array from the RSI indicator (period 14, 1 value back)
    INDICATOR_RSI(rsi, niftyBank, M15, 14, 1);

    // enter long when RSI crosses back above 30
    if (rsi[0] > 30 && rsi[1] <= 30) {
        OrderSend(niftyBank, BUY, 1, 0, 0, 0, NORMAL, DAY, "rsi entry");
    }
}

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.