Place AutoTrader Bracket Order
Place a bracket order with a target, stoploss and trailing stoploss that works on every broker.
https://apix.stocksdeveloper.in/trading/placeAutoTraderBracketOrder The Place AutoTrader Bracket Order call places our own bracket order — an ordinary intraday entry with a target, a stoploss and an optional trailing stoploss attached, watched by AutoTrader Web. Unlike Place Bracket Order, which uses your broker's bracket order and works only where your broker offers one, this works on every broker we support. It is available in Python, Java, C# and the HTTP REST API. On success it returns an order id; on failure it returns an error message.
This call places an AutoTrader bracket order (AT_BO). Your entry goes to your broker as an ordinary intraday order, and AutoTrader Web watches the price and closes the position when your target or stoploss is reached — so it works on every broker we support, including brokers that do not offer bracket orders of their own.
This is a different call from Place Bracket Order, which uses your broker’s bracket order and is unchanged. Nothing you already run changes behaviour.
Target, stoploss and trailing stoploss are distances in rupees from your entry price, not prices — the same as they are for Place Bracket Order. On a buy filled at 180.50, target=5 closes at 185.50 and stoploss=2.5 closes at 178.00. The trailingStoploss is the step the stop moves in each time the price advances by that much, so it needs a stoploss alongside it to say how far behind the price the stop sits; sending it alone is rejected. See Bracket & Cover Orders for the full explanation and an interactive example.
Three things this call does not do: it does not give you the extra intraday margin some brokers give on their own bracket orders, it is intraday only and squares itself off before the market closes, and your levels are watched by AutoTrader Web rather than resting at the exchange.
Code samples
HTTP
Example
curl https://apix.stocksdeveloper.in/trading/placeAutoTraderBracketOrder \
-H "api-key: <your-api-key>" \
-d "pseudoAccount=ACC_NICK_NAME" \
-d "exchange=<exchange>" \
-d "symbol=SBIN" \
-d "tradeType=BUY" \
-d "orderType=LIMIT" \
-d "quantity=10" \
-d "price=180.5" \
-d "triggerPrice=0" \
-d "target=5" \
-d "stoploss=2.5" \
-d "trailingStoploss=1"Response
{
"result":"200622000335719",
"error":null,
"message":null,
"status":true,
"commandId":"9b87532c-cade-49d3-8ace-76db7be63029"
}The response fields work as follows:
| Field | Meaning |
|---|---|
result | The order id given by your trading platform, for the entry order. |
status | true on success. On error, it is false and message holds the error text. |
commandId | Used to trace the activity on AutoTrader Web. |
Python
Signature
def place_autotrader_bracket_order(self, pseudo_account, \
exchange, symbol, tradeType, orderType, \
quantity, price, triggerPrice,
target, stoploss, trailingStoploss=0.0):Example
response = autotrader.place_autotrader_bracket_order( \
'ACC_NICK_NAME', '<exchange>', 'SBIN', 'BUY', 'LIMIT', \
10, 180.5, 0.0, 5, 2.5, 1)
if response.success():
print("Result: {0}".format(response.result))
else:
print("Message: {0}".format(response.message))Java
Signature
/**
* Places an AutoTrader bracket order.
*
* @param pseudoAccount pseudo account
* @param exchange exchange
* @param symbol symbol
* @param tradeType trade type
* @param orderType order type
* @param quantity quantity
* @param price price
* @param triggerPrice trigger price (entry trigger; pass zero otherwise)
* @param target target, in rupees away from your entry price
* @param stoploss stoploss, in rupees away from your entry price
* @param trailingStoploss trailing stoploss step, in rupees
* @return the order id given by your stock broker
*/
IOperationResponse<String> placeAutoTraderBracketOrder(
String pseudoAccount, String exchange, String symbol,
TradeType tradeType, OrderType orderType, int quantity,
float price, float triggerPrice, float target,
float stoploss, float trailingStoploss);Example
// Place an AutoTrader bracket order
final IOperationResponse<String> response = autotrader
.placeAutoTraderBracketOrder("ACC_NICK_NAME", "<exchange>", "SBIN",
TradeType.BUY, OrderType.LIMIT,
10, 180.5f, 0f, 5f, 2.5f, 1f);
// Read order id
String orderId = null;
if (response.success()) {
orderId = response.getResult();
} else {
final String errorMessage = response.getMessage();
}This places the order into the trading account mapped to the passed pseudo account. The response object has a success() method, which returns true on successful execution. Use getResult() to read the order id given by your trading platform.
C#
Signature
/// <summary>
/// Places an AutoTrader bracket order.
/// </summary>
/// <param name="pseudoAccount"> pseudo account </param>
/// <param name="exchange"> exchange </param>
/// <param name="symbol"> symbol </param>
/// <param name="tradeType"> trade type </param>
/// <param name="orderType"> order type </param>
/// <param name="quantity"> quantity </param>
/// <param name="price"> price </param>
/// <param name="triggerPrice"> trigger price </param>
/// <param name="target"> target, in rupees away from your entry price </param>
/// <param name="stoploss"> stoploss, in rupees away from your entry price </param>
/// <param name="trailingStoploss"> trailing stoploss step, in rupees </param>
/// <returns> the order id given by your stock broker </returns>
IOperationResponse<String> PlaceAutoTraderBracketOrder(
string pseudoAccount, string exchange,
string symbol, TradeType tradeType,
OrderType orderType, int quantity,
float price, float triggerPrice, float target,
float stoploss, float trailingStoploss);Example
IOperationResponse<string> response =
autoTrader.PlaceAutoTraderBracketOrder("ACC_NICK_NAME",
"<exchange>", "SBIN", TradeType.BUY,
OrderType.LIMIT, 10, 180.5f, 0, 5, 2.5f, 1);
if(response.Success()) {
Console.WriteLine("Result: {0}", response.Result);
}
else {
Console.WriteLine("Message: {0}", response.Message);
}Parameters
| Parameter | Description |
|---|---|
| account | nickname of the broker account (also known as pseudo account) |
| exchange | instrument (stock/derivative) exchange |
| symbol | instrument (stock/derivative) symbol |
| tradeType | trade type |
| orderType | order type |
| quantity | quantity |
| price | order price |
| triggerPrice | trigger price for the entry order, when your entry is a stoploss order. Pass zero otherwise. |
| target | target, in rupees away from your entry price. Required. |
| stoploss | stoploss, in rupees away from your entry price. Required. |
| trailingStoploss | trailing stoploss step, in rupees. Pass zero for a stop that does not move. |
There is no productType parameter: an AutoTrader bracket order is always intraday.
Note on quantity: For derivatives on Indian stock exchanges, quantity should be a multiple of the lot size. For example, if a contract’s lot size is 15, then to buy or sell 1 lot you enter 15 quantity. This call cannot be split across the exchange’s maximum quantity for a single order — send a quantity within the limit, or place several separate orders.
Return value
The call returns the order id given by your trading platform.
The call returns the library order id. The Desktop Client passes the request on to your broker.
Notes
- You must agree to the terms once, before your first AutoTrader bracket or cover order. Until you do, this call is rejected with a message telling you so; open AutoTrader Web, pick
AT_BOin the order window and follow the one-time opt-in. - One at a time per symbol. A second AutoTrader bracket on the same account and symbol is rejected while the first is running.
- To change the target or stoploss after placing, use AutoTrader Web — open the Positions tab and click the
AT_BOtag on the row. There are no API functions for this yet; tell us if you need them. - To close the position now, use Square Off Position. The bracket ends with the position.
- To cancel an entry that has not filled, use Cancel Order. The bracket ends with the entry order.
- Cancel Child Orders does nothing for an AutoTrader bracket order — there are no broker child orders to cancel, because the target and stoploss are not resting at the exchange.
- Your order book shows the entry as an ordinary order. Nothing in the order book marks it as a bracket; the Positions tab in AutoTrader Web is where you see it.
- Needs a recent library version. These calls were added in Python 1.4.0, Java 3.2.0 and C# 1.4.0. If your editor does not offer the function, upgrade the library — see client setup. The HTTP REST call needs nothing installed.
- Not yet available in Excel, AmiBroker or MetaTrader. Use Place Bracket Order there, or the HTTP REST call above.
For related order types, see Place AutoTrader Cover Order, Place Bracket Order and Place Advanced Order.
Thanks for the feedback. Still stuck? Contact support.
Last updated 8 August 2026