SutraLipi docs grammar v1

Lock clause

A lock blocks new orders on a symbol for a period — a cooldown so a strategy doesn't immediately re-enter after an entry or exit. It can be written as a standalone statement, or attached to an order (the lock then begins when that order fires). There are two forms, and both the symbol and the as "label" tag are optional.

lock … for — a fixed duration

Locks for a number of seconds, minutes or hours. Shape: lock [symbol] for <amount> <unit> [as "label"].

// standalone — lock this symbol for 15 minutes
lock nifty for 15 minutes as "cooldown";

// attached to an order — the cooldown begins when the order is sent
OrderSend(nifty, BUY, 1, 0, 0, 0, INTRADAY, DAY, "entry") lock for 5 minutes as "entry cooldown";

lock … until next — until the next candle

Locks until the next candle of a timeframe opens — e.g. no new entry until the next 15-minute bar. Shape: lock [symbol] until next <timeframe> [as "label"].

// standalone — no new entry until the next 15-minute candle
lock nifty until next M15 as "wait";

// attached to an order
OrderSend(nifty, SELL, 1, 0, 0, 0, INTRADAY, DAY, "short") lock until next M5;

The symbol is optional — omit it (lock for 5 minutes;) to apply a global lock across all symbols. The as "label" is an optional name for the lock.

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.