Skip to Content

Smart Trail

This API allows you to place a trailing stop-loss order whose stop price follows the market as it moves in your favour.

USE CASE

Protect an open position with a stop-loss that moves with the price to lock in gains.

Note

For sell orders, the stop price moves up as the price rises. For buy orders, the stop price moves down as the price falls.

  • The order is triggered when the market price hits the trailing stop price.
  • You can optionally set a target price to book profits automatically.
  • Supports both Limit and Market (MPP) order types for execution.
  • Supports only selected NSE and BSE symbols.

Details

  • A Smart Trail Order is a trailing stop-loss that automatically adjusts the stop price as the market moves in your favour. The stop price trails the market by a specified jump price.
  • jump_diff is how far the stop trails. It must be at least 0.2 and more than 20 times the tick size.
  • stopPrice must be greater than 0. productType can be CNC, MARGIN, INTRADAY or MTF.
  • For a Limit order (orderType 1) send limitPrice. For a Market order (orderType 2) leave limitPrice out or 0.
  • For a Market order, a buy stopPrice must be at or above LTP, and a sell stopPrice at or below LTP.
  • target_price is optional. If sent, it must be above LTP for a sell order and below LTP for a buy order.
  • qty must be 1 to 999999 and a multiple of the lot size. mpp must be 0 to 3 or -1.
  • Smart orders can be created only on trading days (not special trading days), from 8:00 AM and within regular trading hours. The limit is 100 smart orders per day.
  • Rate limits differ between the Standard and Prime plans. See Plans & rate limits.

Request Attributes

AttributeData TypeRequiredDescription
symbolstringYesThe instrument's unique identifier, e.g., "NSE:SBIN-EQ"
sideintYesOrder side: 1 for Buy, -1 for Sell (enum: 1, -1)
qtyintYesOrder quantity (Min: 1, Max: 999999; must be a multiple of lot size)
productTypestringYesMust be one of: "CNC", "MARGIN", "INTRADAY", "MTF"
orderTypeintYesOrder type: 1 for Limit Order, 2 for Market Order (enum: 1, 2)
stopPricefloatYesInitial stop/trigger price (must be greater than 0)
jump_difffloatYesJump price — the value by which the stop price trails (Min: 0.2)
limitPricefloatNoDefault: 0. If not provided, executes at market price. Required if orderType = 1.
target_pricefloatNoDefault: 0 (no target). If provided, must be greater than current LTP.
mppfloatNoDefault: 0 (no market protection). Valid values: 0–3 or -1 (disabled).

Validations & Error Messages

AttributeValidation RuleError Message
symbolMust be a valid trading symbol"The symbol entered is invalid."
symbolMust be allowed for smart orders"The selected symbol is not allowed for placing smart orders. Please try again with a different symbol."
symbolMust be allowed for this segment"The smart order not allowed for this segment"
sideMust be 1 or -1"The input details entered is invalid."
qtyMin: 1, Max: 999999, must be multiple of lot size"Quantity should be multiple of min lot size."
productTypeMust be one of: CNC, MARGIN, INTRADAY, MTF"productType must be one of the following: CNC, MARGIN, INTRADAY, MTF"
orderTypeMust be 1 or 2"orderType must be one of the following: 1, 2"
stopPriceMin: 0, cannot be 0 for placing order"Stop Price is required to place orders."
jump_diffMin: 0.2, must be > 20× tick size"The jump price must be more than 20 times the tick size."
limitPrice (buy)If orderType=1, must be < stopPrice"For buy orders, the stop price must be lower than the limit price."
limitPrice (sell)If orderType=1, must be > stopPrice"For sell orders, the stop price must be higher than the limit price."
target_price (sell)If provided (>0), must be > current LTP"The target price must be greater than the last traded price for sell orders."
target_price (buy)If provided (>0), must be < current LTP"The target price must be lesser than the last traded price for buy orders."
mppIf provided (>0), must be 0-3 or -1"MPP must be either -1 or a value between 0 to 3% (0 to 3)."
limitPriceIf orderType=2 (Market), limitPrice must be 0 / not provided"Limit price is not required."
stopPrice (buy, orderType=2)Must be >= current LTP"For buy orders, the stop price must be greater than the last traded price."
stopPrice (sell, orderType=2)Must be <= current LTP"For sell orders, the stop price must be less than the last traded price."
flowtypeMust be a valid smart order type"The smart order specified in the URL path is not recognized."
UserMust not be banned for smart orders"You are banned for smart order. Please contact support"
Trading dayMust not be market-closed day"You can't create smart orders on market-closed day"
Trading daySmart orders not allowed on special trading day"Smart orders are not allowed on special trading day"
Trading hoursMust not be after market hours"Smart orders cannot be created after market hours."
Trading hoursMust not be before 8:00 AM"Smart orders are not allowed to be created before 8:00 AM."
Trading hoursMust be within regular trading hours"You can't place a smart order outside regular trading hours"
Daily limitMax 100 smart orders/day"You have exceeded the maximum limit of creating 100 smart orders for the day."

Response Attributes

AttributeData TypeDescription
codeintStatus code: 200 indicates success; negative values indicate errors.
messagestringDescriptive message — e.g., "Request sent successfully to place smart order." or error reason.
sstring"ok" for success, "error" for failure.
idstringUnique identifier for the placed smart order (returned only on success).
Last updated on