API Parameters
The standard, broker independent values you pass to every AutoTrader API function.
These are the standard parameters you pass to AutoTrader API functions. AutoTrader hides each broker's order, position, trade and margin formats behind one common format. You send values in this standard format, and the software converts them to the format your broker needs.
Every trading platform has its own format for orders, positions, trades and margins. AutoTrader’s job is to hide those differences and give you a single standard format. You pass values in the standard format defined by the AutoTrader team, and the software converts them internally for your trading platform.
The AutoTrader API is offered in multiple programming languages. The descriptions below are generic and apply to all of them, so there may be small differences. Please also check the language-specific examples for your client setup.
Order Id
Data type: Text or String
An order id uniquely identifies an order. In AutoTrader you deal with 3 types of order ids.
- Publisher Id — Used in languages like AmiBroker AFL or MetaTrader MQL, where direct HTTP REST communication is not possible. This id is generated by the API functions, and AutoTrader maps it to the actual order. It may not be unique across different users, because it is generated on the client side.
- System Id — When AutoTrader receives a new order, it assigns a new id. This id is unique across all users of the AutoTrader platform.
- Platform Id — The id given to the order by your stock broker’s trading platform.
Account
Data type: Text or String
A nickname (also known as a pseudo account) you have given for your broker account. The system maps it internally to an actual trading account. Taking a nickname instead of the real broker account lets you switch broker accounts from the system without changing your code. See how to create a nickname.
Depending on the client, this parameter is named pseudoAccount (HTTP, Java, C#), pseudo_account (Python), PseudoAccount (Excel) or simply account (AmiBroker, MetaTrader). Whatever the name, the value you pass is always the nickname. For example:
pseudoAccount=ACC_NICK_NAME
Note: You can rename a nickname later from the Trading Accounts screen. The nickname is the name your code passes here, so if you rename it, update the name in your code to match. If you do not, your orders will fail.
Variety
Data type: Text or String or Enumeration
Variety represents the kind of an order.
| Value | Meaning |
|---|---|
| REGULAR | A regular order |
| BO | Your broker’s own bracket order — available only on brokers that offer one |
| CO | Your broker’s own cover order — available only on brokers that offer one |
| AT_BO | An AutoTrader bracket order — works on every broker we support |
| AT_CO | An AutoTrader cover order — works on every broker we support |
AT_BO and AT_CO are our own bracket and cover orders. Your entry is placed as an ordinary
intraday order and AutoTrader Web watches your target and stoploss, so they work even on brokers
that do not offer bracket or cover orders. They are always intraday, they do not give the extra
margin some brokers give on their own bracket orders, and the position is squared off automatically
before the market closes. See Bracket & Cover Orders.
Exchange
Data type: Text or String or Enumeration
An exchange represents the Indian stock exchange on which the order symbol is traded. Pass the standard code for the relevant exchange and market segment, for example the cash segment, the F&O segment or the commodity segment.
Symbol
Data type: Text or String
A symbol represents a stock or derivative contract. The symbol must be a broker independent symbol. You can use this Indian API stock symbol search tool.
Trade Type
Data type: Text or String or Enumeration
Represents a trade type, sometimes called transaction type. The valid trade types are:
| Value | Meaning |
|---|---|
| BUY | A buy order |
| SELL | A sell order |
| SHORT | A sell order (added for charting software support — only allowed in csv format used by Desktop client) |
| COVER | A buy order (added for charting software support — only allowed in csv format used by Desktop client) |
Order Type
Data type: Text or String or Enumeration
Represents an order type. There are 4 valid order types.
| Value | Meaning |
|---|---|
| LIMIT | A limit order |
| MARKET | A market order |
| STOP_LOSS | A stoploss order |
| SL_MARKET | A stoploss market order |
Product Type
Data type: Text or String or Enumeration
Represents a product type. There are 4 valid product types.
| Value | Meaning |
|---|---|
| INTRADAY | An intraday or MIS order |
| DELIVERY | A delivery order |
| NORMAL | A normal order |
| MTF | A margin trading facility order (also known as buy now pay later). Supported only by brokers that offer MTF. |
Validity
Data type: Text or String or Enumeration
Represents order validity. There are 2 valid values.
| Value | Meaning |
|---|---|
| DAY | Order is valid for the day (this is the default) |
| IOC | Immediate or cancel |
Note: Do not confuse Validity with Product Type. They are different things.
Quantity
Data type: Numeric or Integer
AutoTrader passes the quantity as it is to the trading platform.
The confusion usually happens for derivatives: should you pass quantity as a multiple of lot size, or as a number of lots? All trading platforms supported by AutoTrader take quantity in multiple of lot size.
Example: To buy 1 lot of NIFTY Future (assuming a lot size of 75), enter the quantity as:
= (#lots * lots_size) = (1 * 75) = 75
Disclosed Quantity
Data type: Numeric or Integer
Represents a disclosed quantity. It is optional and defaults to zero.
Price
Data type: Decimal or Float
Represents the order price. For a market order, this price defaults to zero.
Note: Price is automatically rounded to the nearest tick price, so you need not worry about price being a multiple of tick size. Example: a price of 50.54 with a tick size of 0.05 becomes 50.55.
Trigger Price
Data type: Decimal or Float
Represents a trigger price. It is used in a stoploss order or a cover order.
For a cover order, this is the actual price your stop-loss sits at. It is a price, not a distance. This is worth remembering, because a bracket order works the other way round: its stoploss is a distance from your entry, not a price. See Stoploss (Bracket Order) below.
Note: Trigger price is automatically rounded to the nearest tick price, so you need not worry about it being a multiple of tick size. Example: a price of 50.54 with a tick size of 0.05 becomes 50.55.
Target (Bracket Order)
Data type: Decimal or Float
Represents the target of a bracket order, as a distance from your entry price. It is not the price you want to exit at.
Example: you buy at 180.50 and pass target=5. Your target sits at 185.50, which is 5 above your entry.
A common mistake is to pass the exit price itself. If you want to exit at 185.50 after buying at 180.50, pass target=5, not target=185.5 — the second one asks for a target 185.50 away from your entry.
On a sell order the target sits below your entry, because that is the profitable side. You still pass the same positive distance.
The same value and the same meaning apply to an AutoTrader bracket order (AT_BO). An AutoTrader cover order (AT_CO) has no target.
Stoploss (Bracket Order)
Data type: Decimal or Float
Represents the stoploss of a bracket order, as a distance from your entry price. It is not the price you want your stop to sit at.
Example: you buy at 180.50 and pass stoploss=2.5. Your stop sits at 178.00, which is 2.50 below your entry.
On a sell order the stop sits above your entry. You still pass the same positive distance.
The same value and the same meaning apply to an AutoTrader bracket order (AT_BO) and to an AutoTrader cover order (AT_CO).
⚠️ Note the difference from your broker’s cover order. On a CO the stop is given as a real price, in Trigger Price above. On an AT_CO it is given here, as a distance from your entry price — and there is no trigger price at all. Passing a stop price where a distance is expected is the one mistake worth checking for when you move a cover order across.
Trailing Stoploss (Bracket Order)
Data type: Decimal or Float
Represents the trailing stoploss of a bracket order: the step your stop-loss moves by as the price moves in your favour. Like the two values above, it is a distance, not a price. It only ever moves your stop closer to the current price, never further away.
Example: you buy at 180.50 with stoploss=2.5 and trailingStoploss=1. Your stop starts at 178.00, and moves up in steps of 1 as the price rises.
Pass it as a rupee amount — for example, 1 for a one-rupee step.
Some brokers work a little differently. Their own system takes the trailing stoploss as a number of ticks. On such a system, a one-rupee step on an instrument with a tick size of 0.05 would have to be entered as 20, calculated as 1 divided by 0.05.
You do not need to do that here. Because AutoTrader is broker independent, always pass the rupee amount. The software reads the tick size and converts it into ticks for you where the broker needs it.
A trailing stoploss needs a stoploss with it. The stoploss says how far behind the price your stop sits; the trailing stoploss says how much it moves each step. On its own, a trailing value cannot say both, so an order carrying only a trailing stoploss is rejected before it is placed. This applies to bracket orders, AutoTrader bracket and cover orders, and alerts alike.
The stop moves in whole steps. Buy at 100 with stoploss=10 and trailingStoploss=2: the stop starts at 90, is still 90 when the price reaches 101, and moves to 92 once the price reaches 102. You can try this on the Bracket & Cover Orders page.
AMO
Data type: Text or String or Boolean
Indicates whether an order is an After Market Order.
| Value | Meaning |
|---|---|
| TRUE | The order is an AMO |
| FALSE | The order is not an AMO (this is the default) |
Validate
Data type: Boolean
This parameter is only used in AmiBroker. When set to True, the system will not accept back to back BUY or back to back SELL orders. It treats them as duplicate orders caused by a known limitation of AmiBroker. When you get a signal in AmiBroker, it stays active until the candle completes. Every time the strategy runs during this active state, it sees the signal is active and places an order, which results in duplicate orders.
AmiBroker experts can set it to False and manage the signal in their own strategy code. This simple flag was built for beginners.
OrderStatus
Data type: Text or String or Enumeration
Represents order status in a broker-independent way. Broker-specific statuses are not uniform, so AutoTrader parses them into a standard status.
| Value | Meaning |
|---|---|
| OPEN | Open |
| COMPLETE | Complete |
| CANCELLED | Cancelled |
| REJECTED | Rejected |
| TRIGGER_PENDING | Trigger pending |
| UNKNOWN | Unknown (when the system cannot determine the type from the raw order status received from the stock broker) |
MarginCategory
Data type: Text or String or Enumeration
Represents margin category.
| Value | Meaning |
|---|---|
| EQUITY | Margin for the Equity section of your account |
| COMMODITY | Margin for the Commodity section of your account |
| ALL | Combined margin for Equity and Commodity |
PositionCategory
Data type: Text or String or Enumeration
Represents position category.
| Value | Meaning |
|---|---|
| DAY | Snapshot of the buying and selling activity for that particular day |
| NET | Actual or current net position |
Not every broker sends both. Some brokers give NET only, so a read scoped to DAY returns nothing for those accounts. NET works for every broker, so prefer it unless you specifically need today’s activity on its own. See precautions for the brokers this applies to.
PositionType
Data type: Text or String or Enumeration
Represents position type.
| Value | Meaning |
|---|---|
| MIS | MIS or intraday position |
| CNC | CNC or delivery position |
| NRML | Normal position position |
| BO | BracketOrder position |
| CO | CoverOrder position |
PositionState
Data type: Text or String or Enumeration
Represents the state of the position, which can be either OPEN or CLOSED.
| Value | Meaning |
|---|---|
| OPEN | The position is open |
| CLOSED | The position is closed |
PositionDirection
Data type: Text or String or Enumeration
Represents the direction of the position.
| Value | Meaning |
|---|---|
| LONG | A long position |
| SHORT | A short position |
| NEUTRAL | A neutral position |
Related pages
Frequently asked questions
Is the bracket order target a price, or a distance from my entry?▾
It is a distance from your entry price, not the price you want to exit at. The same is true of the bracket order stoploss and trailing stoploss. For example, if you buy at 180.50 and pass target=5, your target sits at 185.50. A cover order is the one exception: there, the stop is given as a real price in the triggerPrice parameter.
Is pseudoAccount the same as the account nickname?▾
Yes. The pseudoAccount parameter takes your account's nickname — the name you gave your broker account in AutoTrader Web. The API keeps the older name pseudoAccount, but the value you pass is the nickname. For example: pseudoAccount=ACC_NICK_NAME.
Next steps
Thanks for the feedback. Still stuck? Contact support.
Last updated 8 August 2026