SutraLipi docs grammar v1

Order commands

On every order the product, validity and a remark are required, in that order, at the end of the call.

OrderSend

OrderSend(symbol, type, qty, price, sl, tp, product, validity, remark). For a market order pass 0 for price, sl and tp.

// market buy — intraday, day validity
OrderSend(nifty, BUY, 1, 0, 0, 0, INTRADAY, DAY, "entry");

// price/sl/tp are an optional group — omit them entirely for a plain market order
OrderSend(nifty, BUY, 1, INTRADAY, DAY, "entry");

// buy limit at 100 with SL 95 and TP 110
OrderSend(nifty, BUYLIMIT, 1, 100, 95, 110, NORMAL, DAY, "limit entry");

Order types: BUY SELL BUYLIMIT SELLLIMIT BUYSTOP SELLSTOP. Product: NORMAL / INTRADAY / CNC. Validity: DAY / IOC.

OrderModify

Modify by Symbol, Ticket or Magic. A value of 0 leaves that field unchanged.

// move SL to 98, keep price and TP as-is
OrderModifyBySymbol(nifty, 0, 98, 0, "trail sl");
OrderModifyByTicket(1234, 0, 98, 0, "trail sl");
OrderModifyByMagic(7, 0, 98, 0, "trail sl");

OrderClose

Close by Symbol / Ticket / Magic, or close everything with OrderCloseAll. An optional partial volume can precede the product.

OrderCloseBySymbol(nifty, INTRADAY, DAY, "exit");          // all positions for this symbol
OrderCloseBySymbol(nifty, 1, INTRADAY, DAY, "partial");    // optional partial volume (1 lot)
OrderCloseByTicket(1234, INTRADAY, DAY, "exit ticket");    // a specific order id
OrderCloseByMagic(7, INTRADAY, DAY, "exit magic");         // all orders with this magic number
OrderCloseAll(INTRADAY, DAY, "square off");                // close everything

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.