MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal

Automated Trading Language Documentation

T ConnectionT Connection Try product
T Connection
Author: GusPaint
Screenshot
EURJPY, M15
Real
Subscribe to signal
FXpipmakers
25.17%, 4 373.96 USD
Creating an Information Board Using the Standard Library Classes and Google Chart API Creating an Information Board Using the Standard Library... IncDeMarkerOnArray Library
IncDeMarkerOnArray
Author: Integer

OrderOpen

Places the pending order with set parameters.

bool  OrderOpen(
   const string          symbol,          // symbol
   ENUM_ORDER_TYPE       order_type,      // order type
   double                volume,          // order volume
   double                limit_price,     // StopLimit price
   double                price,           // execution price
   double                sl,              // Stop Loss price
   double                tp,              // Take Profit price
   ENUM_ORDER_TYPE_TIME  type_time,       // type by expiration
   datetime              expiration,      // expiration
   const string          comment=""       // comment
   )

Parameters

symbol

[in] Name of trade instrument.

order_type

[in]  Type of order trade operation (value of ENUM_ORDER_TYPE enumeration).

volume

[in] Requested order volume.

limit_price

[in] Price at which the StopLimit order will be placed.

price

[in] Price at which the order must be executed.

sl

[in] Price at which the Stop Loss will trigger.

tp

[in] Price at which the Take Profit will trigger.

type_time

[in]  Order type by execution (value of ENUM_ORDER_TYPE_TIME enumeration).

expiration

[in] Expiration date of pending order.

comment=""

[in]  Order comment.

Returned value

true - in case of successful check of the basic structures, otherwise - false.

Note

Successful completion of the OrderSend(...) method does not always mean successful execution of the trade operation. It's necessary to check the result of trade request (trade server return code) using ResultRetcode() and value, returned by ResultOrder().


Updated: 2010.12.15