Requests to execute trade operations are formalized as orders. Each order has a variety of properties for reading. Information on them can be obtained using functions OrderGet...() and HistoryOrderGet...().
For functions OrderGetInteger() and HistoryOrderGetInteger()
Identifier |
Description |
Type |
ORDER_TIME_SETUP |
Order setup time |
datetime |
ORDER_TYPE |
Order type |
|
ORDER_STATE |
Order state |
|
ORDER_TIME_EXPIRATION |
Order expiration time |
datetime |
ORDER_TIME_DONE |
Order execution or cancellation time |
datetime |
ORDER_TIME_SETUP_MSC |
The time of placing an order for execution in milliseconds since 01.01.1970 |
long |
ORDER_TIME_DONE_MSC |
Order execution/cancellation time in milliseconds since 01.01.1970 |
long |
ORDER_TYPE_FILLING |
Order filling type |
|
ORDER_TYPE_TIME |
Order lifetime |
|
ORDER_MAGIC |
ID of an Expert Advisor that has placed the order (designed to ensure that each Expert Advisor places its own unique number) |
long |
ORDER_POSITION_ID |
Position identifier that is set to an order as soon as it is executed. Each executed order results in a deal that opens or modifies an already existing position. The identifier of exactly this position is set to the executed order at this moment. |
long |
For functions OrderGetDouble() and HistoryOrderGetDouble()
Identifier |
Description |
Type |
ORDER_VOLUME_INITIAL |
Order initial volume |
double |
ORDER_VOLUME_CURRENT |
Order current volume |
double |
ORDER_PRICE_OPEN |
Price specified in the order |
double |
ORDER_SL |
Stop Loss value |
double |
ORDER_TP |
Take Profit value |
double |
ORDER_PRICE_CURRENT |
The current price of the order symbol |
double |
ORDER_PRICE_STOPLIMIT |
The Limit order price for the StopLimit order |
double |
For functions OrderGetString() and HistoryOrderGetString()
Identifier |
Description |
Type |
ORDER_SYMBOL |
Symbol of the order |
string |
ORDER_COMMENT |
Order comment |
string |
When sending a trade request using the OrderSend() function, some operations require the indication of the order type. The order type is specified in the type field of the special structure MqlTradeRequest, and can accept values of the ENUM_ORDER_TYPE enumeration.
Identifier |
Description |
ORDER_TYPE_BUY |
Market Buy order |
ORDER_TYPE_SELL |
Market Sell order |
ORDER_TYPE_BUY_LIMIT |
Buy Limit pending order |
ORDER_TYPE_SELL_LIMIT |
Sell Limit pending order |
ORDER_TYPE_BUY_STOP |
Buy Stop pending order |
ORDER_TYPE_SELL_STOP |
Sell Stop pending order |
ORDER_TYPE_BUY_STOP_LIMIT |
Upon reaching the order price, a pending Buy Limit order is places at the StopLimit price |
ORDER_TYPE_SELL_STOP_LIMIT |
Upon reaching the order price, a pending Sell Limit order is places at the StopLimit price |
Each order has a status that describes its state. To obtain information, use OrderGetInteger() or HistoryOrderGetInteger() with the ORDER_STATE modifier. Allowed values are stored in the ENUM_ORDER_STATE enumeration.
Identifier |
Description |
ORDER_STATE_STARTED |
Order checked, but not yet accepted by broker |
ORDER_STATE_PLACED |
Order accepted |
ORDER_STATE_CANCELED |
Order canceled by client |
ORDER_STATE_PARTIAL |
Order partially executed |
ORDER_STATE_FILLED |
Order fully executed |
ORDER_STATE_REJECTED |
Order rejected |
ORDER_STATE_EXPIRED |
Order expired |
ORDER_STATE_REQUEST_ADD |
Order is being registered (placing to the trading system) |
ORDER_STATE_REQUEST_MODIFY |
Order is being modified (changing its parameters) |
ORDER_STATE_REQUEST_CANCEL |
Order is being deleted (deleting from the trading system) |
When sending a trade request using the OrderSend() function, the filling policy can be set for an order in the type_filling field of the special structure MqlTradeRequest. Values of the ENUM_ORDER_TYPE_FILLING enumeration are allowed. To obtain the value of this property, use the function OrderGetInteger() or HistoryOrderGetInteger() with the ORDER_TYPE_FILLING modifier.
Identifier |
Description |
ORDER_FILLING_FOK |
This filling policy means that an order can be filled only in the specified amount. If the necessary amount of a financial instrument is currently unavailable in the market, the order will not be executed. The required volume can be filled using several offers available on the market at the moment. |
ORDER_FILLING_IOC |
This mode means that a trader agrees to execute a deal with the volume maximally available in the market within that indicated in the order. In case the the entire volume of an order cannot be filled, the available volume of it will be filled, and the remaining volume will be canceled. |
ORDER_FILLING_RETURN |
This policy is used only for market orders (ORDER_TYPE_BUY and ORDER_TYPE_SELL), limit and stop limit orders (ORDER_TYPE_BUY_LIMIT, ORDER_TYPE_SELL_LIMIT, ORDER_TYPE_BUY_STOP_LIMIT and ORDER_TYPE_SELL_STOP_LIMIT ) and only for the symbols with Market or Exchange execution. In case of partial filling a market or limit order with remaining volume is not canceled but processed further. For the activation of the ORDER_TYPE_BUY_STOP_LIMIT and ORDER_TYPE_SELL_STOP_LIMIT orders, a corresponding limit order ORDER_TYPE_BUY_LIMIT/ORDER_TYPE_SELL_LIMIT with the ORDER_FILLING_RETURN execution type is created. |
The order validity period can be set in the type_time field of the special structure MqlTradeRequest when sending a trade request using the OrderSend() function. Values of the ENUM_ORDER_TYPE_TIME enumeration are allowed. To obtain the value of this property use the function OrderGetInteger() or HistoryOrderGetInteger() with the ORDER_TYPE_TIME modifier.
Identifier |
Description |
ORDER_TIME_GTC |
Good till cancel order |
ORDER_TIME_DAY |
Good till current trade day order |
ORDER_TIME_SPECIFIED |
Good till expired order |
ORDER_TIME_SPECIFIED_DAY |
The order will be effective till 00:00 of the specified day. If this time is outside a trading session, the order expires in the nearest trading time. |