Skip to content

Trade Functions

Trade Functions

This is the group of functions intended for managing trading activities. Trading functions can be called only if in the properties of the Expert Advisor or script the “Allow live trading” checkbox is enabled.

Trading can be allowed or prohibited depending on various factors described in the Trade Permission section.

FunctionAction
OrderCalcMarginCalculates the margin required for the specified order type, in the deposit currency
OrderCalcProfitCalculates the profit based on the parameters passed, in the deposit currency
OrderCheckChecks if there are enough funds to execute the required trade operation.
OrderSendSends trade requests to a server
OrderSendAsyncAsynchronously sends trade requests without waiting for the trade response of the trade server
PositionsTotalReturns the number of open positions
PositionGetSymbolReturns the symbol corresponding to the open position
PositionSelectChooses an open position for further working with it
PositionSelectByTicketSelects a position to work with by the ticket number specified in it
PositionGetDoubleReturns the requested property of an open position (double)
PositionGetIntegerReturns the requested property of an open position (datetime or int)
PositionGetStringReturns the requested property of an open position (string)
PositionGetTicketReturns the ticket of the position with the specified index in the list of open positions
OrdersTotalReturns the number of orders
OrderGetTicketReturn the ticket of a corresponding order
OrderSelectSelects a order for further working with it
OrderGetDoubleReturns the requested property of the order (double)
OrderGetIntegerReturns the requested property of the order (datetime or int)
OrderGetStringReturns the requested property of the order (string)
HistorySelectRetrieves the history of transactions and orders for the specified period of the server time
HistorySelectByPositionRequests the history of deals with a specified position identifier.
HistoryOrderSelectSelects an order in the history for further working with it
HistoryOrdersTotalReturns the number of orders in the history
HistoryOrderGetTicketReturn order ticket of a corresponding order in the history
HistoryOrderGetDoubleReturns the requested property of an order in the history (double)
HistoryOrderGetIntegerReturns the requested property of an order in the history (datetime or int)
HistoryOrderGetStringReturns the requested property of an order in the history (string)
HistoryDealSelectSelects a deal in the history for further calling it through appropriate functions
HistoryDealsTotalReturns the number of deals in the history
HistoryDealGetTicketReturns a ticket of a corresponding deal in the history
HistoryDealGetDoubleReturns the requested property of a deal in the history (double)
HistoryDealGetIntegerReturns the requested property of a deal in the history (datetime or int)
HistoryDealGetStringReturns the requested property of a deal in the history (string)
Last updated on