Documentation
The long-awaited program of the website beta testing has been launched. For some time the website operation may be inconsistent. The website developers are filling up its contents now doing their best to make it maximum convenient for you. Please accept our apologies for the temporary inconvenience.
MQL5 ReferenceTrade Functions 

Trade Functions

This is the group of functions intended for managing trading activities.

Trading functions can be used in Expert Advisors and scripts. Trading functions can be called only if in the properties of the Expert Advisor or script the "Allow live trading" checkbox is enabled.

Function

Action

OrderSend

Sends trade requests to a server

PositionsTotal

Returns the number of open positions

PositionGetSymbol

Returns the symbol corresponding to the open position

PositionSelect

Chooses an open position for further working with it

PositionGetDouble

Returns the requested property of an open position (double)

PositionGetInteger

Returns the requested property of an open position (datetime or int)

PositionGetString

Returns the requested property of an open position (string)

OrdersTotal

Returns the number of orders

OrderGetTicket

Return the ticket of a corresponding order

OrderSelect

Selects a order for further working with it

OrderGetDouble

Returns the requested property of the order (double)

OrderGetInteger

Returns the requested property of the order (datetime or int)

OrderGetString

Returns the requested property of the order (string)

HistorySelect

Retrieves the history of transactions and orders for the specified period of the server time

HistoryOrderSelect

Selects an order in the history for further working with it

HistoryOrdersTotal

Returns the number of orders in the history

HistoryOrderGetTicket

Return order ticket of a corresponding order in the history

HistoryOrderGetDouble

Returns the requested property of an order in the history of (double)

HistoryOrderGetInteger

Returns the requested property of an order in the history (datetime or int)

HistoryOrderGetString

Returns the requested property of an order in the history of (string)

HistoryDealSelect

Selects a deal in the history for further calling it through appropriate functions

HistoryDealsTotal

Returns the number of deals in the history

HistoryDealGetTicket

Returns a ticket of a corresponding deal in the history

HistoryDealGetDouble

Returns the requested property of a deal in the history (double)

HistoryDealGetInteger

Returns the requested property of a deal in the history (datetime or int)

HistoryDealGetString

Returns the requested property of a deal in the history (string)