SutraLipi docs grammar v1

Option chain

Declare an OptionChain, then pick strikes dynamically with chain.ATM/OTM/ITM — no hardcoded strike. Arguments are the option type (unquoted), the expiry, the underlying, and an optional strike offset.

OptionChain  chain = NFO:OPTIDX:"NIFTY";
EquitySymbol nifty = NSE:IDX:"NIFTY";
OptionSymbol ceAtm;
OptionSymbol peOtm;
OptionSymbol ceItm;

onStart {
    ceAtm = chain.ATM(CE, Expiry.Weekly(0), nifty);       // ATM call, current-week expiry
    peOtm = chain.OTM(PE, Expiry.Weekly(1), nifty, 1);    // 1 strike OTM put, next-week expiry
    ceItm = chain.ITM(CE, Expiry.Monthly(0), nifty, 2);   // 2 strikes ITM call, current monthly

    // a chain call may be used inline anywhere a symbol is expected
    OrderSend(chain.ATM(CE, Expiry.Weekly(0), nifty), BUY, 1, NORMAL, DAY, "inline chain");
}

Arguments: option type (CE/PE, unquoted), an expirySpec (any of the four forms above), the underlying, and an optional strike offset — 0/none = ATM, n = n strikes OTM/ITM.

Prefer building visually? The options strategy builder assembles straddles, strangles and iron condors from this same option chain — no code required.

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.