Modify Order Quantity
Change the quantity of an order you already placed, from any client language.
https://apix.stocksdeveloper.in/trading/modifyOrderQuantity The Modify Order Quantity call changes the quantity of an order you already placed. You pass the account, the order id returned by placeOrder, and the new quantity. It returns true on success and false on failure.
This call modifies the quantity of an open order. It is available in AmiBroker, Excel, and MetaTrader. To change the price of an open order instead, see Modify Order Price.
Code samples
Excel
Signature
Public Function ModifyOrderQuantity( _
PseudoAccount As String, _
OrderId As String, _
Quantity As Integer) As BooleanExample
orderId = PlaceOrder("ACC_NAME",
"<exchange>", "SBIN", "BUY",
"LIMIT", "INTRADAY", 10,
100.5, 0, True)
' Somewhere later in your code,
' when you want to modify this order
' Modify the order
Call ModifyOrderQuantity("ACC_NAME", orderId, 20)AmiBroker
Signature
function modifyOrderQuantity(account, orderId, quantity)Example
orderId = placeOrder(AT_ACCOUNT,
AT_EXCHANGE, AT_SYMBOL, "BUY",
"LIMIT", AT_PRODUCT_TYPE, 10,
100.5, defaultTriggerPrice(), True);
// You can save this orderId in a static variable
saveStaticVariableText(AT_ACCOUNT, "ORDER_ID", orderId);
// Somewhere later in your code,
// when you want to modify this order
// Read orderId from static variable
orderId = readStaticVariableText(AT_ACCOUNT, "ORDER_ID");
// Modify the order
modifyOrderQuantity(AT_ACCOUNT, orderId, 20);MetaTrader
Signature
bool modifyOrderQuantity(string account,
string orderId, int quantity)Example
orderId = placeOrder(AT_ACCOUNT,
AT_EXCHANGE, AT_SYMBOL, BUY,
LIMIT, INTRADAY, 10,
100.5, defaultTriggerPrice(), true);
// You can save this orderId in a static variable
// Somewhere later in your code,
// when you want to modify this order
// Modify the order
modifyOrderQuantity(AT_ACCOUNT, orderId, 20);In each example above, we change the quantity from 10 to 20.
Parameters
| Parameter | Description |
|---|---|
| account | nickname of the broker account (also known as pseudo account) |
| orderId | publisherId — the orderId given by a placeOrder*() function |
| quantity | quantity |
Note on quantity: For derivatives on Indian stock exchanges, the quantity must 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.
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
This call sends a request to the AutoTrader Desktop Client to modify the order quantity. It returns true on successful submission, otherwise false.
See also Modify Order Price and Square-off Position.
Thanks for the feedback. Still stuck? Contact support.
Last updated 21 June 2026