# MQL5 OrderSendAsync()

Independent and unofficial. Not affiliated with or endorsed by any broker or platform named here. Educational only: nothing here is advice, and nothing here recommends a broker or a trade.

This is the markdown version of https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-ordersendasync, written from the same records as that page.

Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.

Sends a trade request to the trade server without waiting for its answer. The page describes it as made for high frequency trading, where waiting for the server is not acceptable.

- Function: `OrderSendAsync()`
- Interface: MQL5
- Group: Sending orders
- Status: verified. Source: [mql5.com](https://www.mql5.com/en/docs/trading/ordersendasync), checked 2026-10-12.

This is an MQL5 function, not an HTTP endpoint. It has no method, no path and no address to send a request to: it runs inside the MetaTrader 5 terminal, in a program written in MQL5. It is in no OpenAPI file on this site and the request builder does not list it.

Note: The outcome of the request arrives later, through the OnTradeTransaction and OnTrade handlers. The page says OnTradeTransaction is called several times for one request.

## Signature

The form of the call on the vendor's page, with the vendor's comments taken out.

```mql5
bool OrderSendAsync(
  MqlTradeRequest& request,
  MqlTradeResult& result
)
```

## Arguments

- `request` (type MqlTradeRequest&, required): The trade request, an MqlTradeRequest structure passed by reference.
- `result` (type MqlTradeResult&, required): An MqlTradeResult structure passed by reference. After a successful send its return code holds TRADE_RETCODE_PLACED, which is 10008.

## Return value

- Type: `bool`
- What comes back: True when the request was sent, false when it was not. The page says true means only that it was sent: it is no guarantee the request reached the server or was accepted.

## Sample

Written by this site from the signature and arguments recorded on this page. It has not been run against a terminal, a server or an account, and the values in it are placeholders. It holds no credential and needs none: the program runs inside a terminal that is already logged in to an account. Nothing is entered on this site.

```mql5
// Expert Advisor fragment. Run it only on a demo account.
void SendBuy()
  {
   MqlTradeRequest request={};
   MqlTradeResult  result={};
   request.action=TRADE_ACTION_DEAL;
   request.symbol=_Symbol;
   request.volume=0.1;
   request.type  =ORDER_TYPE_BUY;
   request.price =SymbolInfoDouble(_Symbol,SYMBOL_ASK);
   if(!OrderSendAsync(request,result))
      PrintFormat("OrderSendAsync error %d, retcode=%u",GetLastError(),result.retcode);
  }

// The server's answer arrives here, more than once for one request.
void OnTradeTransaction(const MqlTradeTransaction &trans,const MqlTradeRequest &request,const MqlTradeResult &result)
  {
   Print(EnumToString(trans.type));
  }
```

## Return codes documented for this function

The page says that after a successful send the response code in the result variable holds TRADE_RETCODE_PLACED, code 10008, and its example prints result.retcode. That field holds a trade server return code, and each one recorded here is below. Status: verified. Source: [mql5.com](https://www.mql5.com/en/docs/trading/ordersendasync), checked 2026-10-12.

- [TRADE_RETCODE_REQUOTE (10004)](https://openbrokerapi.com/errors/mt5/trade-retcode-requote): The price changed and the server offered a new one.
- [TRADE_RETCODE_REJECT (10006)](https://openbrokerapi.com/errors/mt5/trade-retcode-reject): The server rejected the request.
- [TRADE_RETCODE_CANCEL (10007)](https://openbrokerapi.com/errors/mt5/10007-trade-retcode-cancel): The request was cancelled by the trader.
- [TRADE_RETCODE_PLACED (10008)](https://openbrokerapi.com/errors/mt5/10008-trade-retcode-placed): The order was placed.
- [TRADE_RETCODE_DONE (10009)](https://openbrokerapi.com/errors/mt5/10009-trade-retcode-done): The request was completed.
- [TRADE_RETCODE_DONE_PARTIAL (10010)](https://openbrokerapi.com/errors/mt5/10010-trade-retcode-done-partial): Only part of the request was completed.
- [TRADE_RETCODE_ERROR (10011)](https://openbrokerapi.com/errors/mt5/10011-trade-retcode-error): The server reports an error in processing the request.
- [TRADE_RETCODE_TIMEOUT (10012)](https://openbrokerapi.com/errors/mt5/10012-trade-retcode-timeout): The request was cancelled because it timed out.
- [TRADE_RETCODE_INVALID (10013)](https://openbrokerapi.com/errors/mt5/trade-retcode-invalid): The trade request is malformed.
- [TRADE_RETCODE_INVALID_VOLUME (10014)](https://openbrokerapi.com/errors/mt5/trade-retcode-invalid-volume): Volume is outside min, max or step for the symbol.
- [TRADE_RETCODE_INVALID_PRICE (10015)](https://openbrokerapi.com/errors/mt5/trade-retcode-invalid-price): The price is not valid.
- [TRADE_RETCODE_INVALID_STOPS (10016)](https://openbrokerapi.com/errors/mt5/trade-retcode-invalid-stops): Stop loss or take profit is invalid, often too close to price.
- [10017 TRADE_RETCODE_TRADE_DISABLED](https://openbrokerapi.com/errors/mt5/10017): Trading is disabled.
- [TRADE_RETCODE_MARKET_CLOSED (10018)](https://openbrokerapi.com/errors/mt5/trade-retcode-market-closed): The market is closed.
- [TRADE_RETCODE_NO_MONEY (10019)](https://openbrokerapi.com/errors/mt5/trade-retcode-no-money): Insufficient margin.
- [TRADE_RETCODE_PRICE_CHANGED (10020)](https://openbrokerapi.com/errors/mt5/10020-trade-retcode-price-changed): Prices changed while the request was being handled.
- [TRADE_RETCODE_PRICE_OFF (10021)](https://openbrokerapi.com/errors/mt5/10021-trade-retcode-price-off): There are no quotes to process the request.
- [10022 TRADE_RETCODE_INVALID_EXPIRATION](https://openbrokerapi.com/errors/mt5/10022): The order expiration date in the request is invalid.
- [TRADE_RETCODE_ORDER_CHANGED (10023)](https://openbrokerapi.com/errors/mt5/10023-trade-retcode-order-changed): The state of the order changed.
- [10024 TRADE_RETCODE_TOO_MANY_REQUESTS](https://openbrokerapi.com/errors/mt5/10024): Requests are being sent too often.
- [TRADE_RETCODE_NO_CHANGES (10025)](https://openbrokerapi.com/errors/mt5/10025-trade-retcode-no-changes): The request contains no changes.
- [10026 TRADE_RETCODE_SERVER_DISABLES_AT](https://openbrokerapi.com/errors/mt5/10026): Autotrading is disabled by the server.
- [TRADE_RETCODE_CLIENT_DISABLES_AT (10027)](https://openbrokerapi.com/errors/mt5/trade-retcode-client-disables-at): Algo trading is switched off in the terminal.
- [TRADE_RETCODE_LOCKED (10028)](https://openbrokerapi.com/errors/mt5/10028-trade-retcode-locked): The request is locked for processing.
- [TRADE_RETCODE_FROZEN (10029)](https://openbrokerapi.com/errors/mt5/10029-trade-retcode-frozen): The order or position is frozen.
- [10030](https://openbrokerapi.com/errors/mt5/10030): Invalid order filling type: order_send asked for a filling mode the symbol does not allow.
- [TRADE_RETCODE_CONNECTION (10031)](https://openbrokerapi.com/errors/mt5/10031-trade-retcode-connection): There is no connection with the trade server.
- [TRADE_RETCODE_ONLY_REAL (10032)](https://openbrokerapi.com/errors/mt5/10032-trade-retcode-only-real): The operation is allowed only for live accounts.
- [TRADE_RETCODE_LIMIT_ORDERS (10033)](https://openbrokerapi.com/errors/mt5/10033-trade-retcode-limit-orders): The number of pending orders has reached the limit.
- [TRADE_RETCODE_LIMIT_VOLUME (10034)](https://openbrokerapi.com/errors/mt5/10034-trade-retcode-limit-volume): The volume of orders and positions for the symbol has reached the limit.
- [TRADE_RETCODE_INVALID_ORDER (10035)](https://openbrokerapi.com/errors/mt5/10035-trade-retcode-invalid-order): The order type is incorrect or prohibited.
- [10036 TRADE_RETCODE_POSITION_CLOSED](https://openbrokerapi.com/errors/mt5/10036): The position with the specified POSITION_IDENTIFIER has already been closed.
- [10038 TRADE_RETCODE_INVALID_CLOSE_VOLUME](https://openbrokerapi.com/errors/mt5/10038): The close volume is larger than the current volume of the position.
- [10039 TRADE_RETCODE_CLOSE_ORDER_EXIST](https://openbrokerapi.com/errors/mt5/10039): A close order already exists for the position.
- [10040 TRADE_RETCODE_LIMIT_POSITIONS](https://openbrokerapi.com/errors/mt5/10040): The number of open positions on the account has reached a limit set on the server.
- [TRADE_RETCODE_REJECT_CANCEL (10041)](https://openbrokerapi.com/errors/mt5/10041-trade-retcode-reject-cancel): The request to activate a pending order was rejected and the order was cancelled.
- [TRADE_RETCODE_LONG_ONLY (10042)](https://openbrokerapi.com/errors/mt5/10042-trade-retcode-long-only): The request was rejected because the symbol has the rule "Only long positions are allowed" (POSITION_TYPE_BUY).
- [TRADE_RETCODE_SHORT_ONLY (10043)](https://openbrokerapi.com/errors/mt5/10043-trade-retcode-short-only): The request was rejected because the symbol has the rule "Only short positions are allowed" (POSITION_TYPE_SELL).
- [TRADE_RETCODE_CLOSE_ONLY (10044)](https://openbrokerapi.com/errors/mt5/10044-trade-retcode-close-only): The request was rejected because the symbol has the rule "Only position closing is allowed".
- [TRADE_RETCODE_FIFO_CLOSE (10045)](https://openbrokerapi.com/errors/mt5/10045-trade-retcode-fifo-close): The request was rejected because the trading account has the flag "Position closing is allowed only by FIFO rule" set (ACCOUNT_FIFO_CLOSE=true).
- [10046 TRADE_RETCODE_HEDGE_PROHIBITED](https://openbrokerapi.com/errors/mt5/10046): The request was rejected because the trading account has the rule "Opposite positions on a single symbol are disabled".

## Related MQL5 functions: Sending orders

- [OrderCalcMargin()](https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-ordercalcmargin): Works out the margin, in the account's currency, that an order of a given type, symbol, volume and price would need on the account as it stands.
- [OrderCalcProfit()](https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-ordercalcprofit): Works out the profit or loss, in the account's currency, of a trade opened at one price and closed at another, on the account and market as they stand.
- [OrderCheck()](https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-ordercheck): Checks whether there is enough money for a trade request without sending it, and writes what the account would look like into a result structure.
- [OrderSend()](https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-ordersend): Sends a trade request to the trade server and waits for its answer. One function covers a market order, a pending order, a change, a cancellation and a close: the action field of the request says which.

## More on MetaTrader 5

- [All MetaTrader 5 functions](https://openbrokerapi.com/platforms/metatrader-5/functions): 78 documented here, grouped by what they do.
- [Place an order: the call at each API](https://openbrokerapi.com/endpoints/place-order): The same job at every broker and platform API recorded here, HTTP or not.
- [MetaTrader 5 API quickstart](https://openbrokerapi.com/platforms/metatrader-5/quickstart)
- [All MetaTrader 5 error codes](https://openbrokerapi.com/errors/mt5)
- [MetaTrader 5 API page](https://openbrokerapi.com/platforms/metatrader-5): The full record: access, authentication, limits and the source for each.

## Licence and how to cite

The records behind this page are all rights reserved. This file is the page itself, at its own address, in another format. It is not part of the CC BY 4.0 downloads listed at https://openbrokerapi.com/data. Quote from it with a link to the page.

Cite as: MQL5 OrderSendAsync(). Broker API Hub, https://openbrokerapi.com/platforms/metatrader-5/functions/mql5-ordersendasync, newest check 2026-10-12.

Where you rely on a single figure, cite the source and the checked date printed beside it as well. Where this page and a broker's own documentation differ, the documentation wins.
