Place a stop-loss (SL) order
An SL order is dormant until the market touches trigger_price, then it becomes a live limit order at price. Two prices, two jobs.
# Long position, protecting against a fall below 1450
order_id = kite.place_order(
variety="regular",
exchange="NSE",
tradingsymbol="INFY",
transaction_type="SELL",
quantity=10,
product="MIS",
order_type="SL",
price=1449.50, # limit price once triggered
trigger_price=1450.00, # price that activates the order
validity="DAY",
)
Why price is slightly below trigger_price for a sell-side SL
Once triggered, this becomes a limit sell at 1449.50 — if the market gaps down past that on the trigger (common in fast-moving conditions), the limit order can rest unfilled while price keeps falling, defeating the purpose of a stop-loss. The gap between trigger and limit price is a deliberate tradeoff: too tight and normal noise triggers it without filling; too wide and it doesn't protect you fast enough.
def compute_sl_prices(entry_price: float, stop_distance: float, limit_buffer: float, side: str):
if side == "SELL": # exiting a long position
trigger = entry_price - stop_distance
limit = trigger - limit_buffer
else: # exiting a short position
trigger = entry_price + stop_distance
limit = trigger + limit_buffer
return trigger, limit
The real problem with SL (limit-based) stop-loss orders
In a fast gap-down, price can blow through both trigger_price and price before the limit order can fill, leaving you holding the position with no protection despite having placed a "stop-loss." This is exactly why SL-M (chapter 51) exists — it removes the limit-price ambiguity at the cost of no price protection on the fill itself.
Order state before trigger: TRIGGER PENDING
status = kite.order_history(order_id)[-1]["status"]
# "TRIGGER PENDING" until trigger_price is hit, then transitions to a live limit order
This status doesn't mean "resting on the exchange" the way a normal limit order does — the order isn't visible to the exchange's order book at all until triggered; it's held by the broker's system watching price.