OrderClientOrderSend Method (String, Op, Double, Double, Int32, Double, Double, String, Int32, DateTime)
|
The main function used to open a position or place a pending order.
Namespace:
TradingAPI.MT4Server
Assembly:
MT4ServerApi (in MT4ServerApi.dll) Version: 4.6.1.8
Syntaxpublic Order OrderSend(
string symbol,
Op operation,
double volume,
double price,
int slippage = 0,
double stoploss = 0,
double takeprofit = 0,
string comment = null,
int magic = 0,
DateTime expiration = null
)
Public Function OrderSend (
symbol As String,
operation As Op,
volume As Double,
price As Double,
Optional slippage As Integer = 0,
Optional stoploss As Double = 0,
Optional takeprofit As Double = 0,
Optional comment As String = Nothing,
Optional magic As Integer = 0,
Optional expiration As DateTime = Nothing
) As Order
public:
Order^ OrderSend(
String^ symbol,
Op operation,
double volume,
double price,
int slippage = 0,
double stoploss = 0,
double takeprofit = 0,
String^ comment = nullptr,
int magic = 0,
DateTime expiration = nullptr
)
member OrderSend :
symbol : string *
operation : Op *
volume : float *
price : float *
?slippage : int *
?stoploss : float *
?takeprofit : float *
?comment : string *
?magic : int *
?expiration : DateTime
(* Defaults:
let _slippage = defaultArg slippage 0
let _stoploss = defaultArg stoploss 0
let _takeprofit = defaultArg takeprofit 0
let _comment = defaultArg comment null
let _magic = defaultArg magic 0
let _expiration = defaultArg expiration null
*)
-> Order
Parameters
- symbol
- Type: SystemString
Symbol for trading. - operation
- Type: TradingAPI.MT4ServerOp
Operation type. - volume
- Type: SystemDouble
Number of lots. - price
- Type: SystemDouble
Preferred price of the trade. - slippage (Optional)
- Type: SystemInt32
Maximum price slippage for buy or sell order. - stoploss (Optional)
- Type: SystemDouble
Stop loss level. - takeprofit (Optional)
- Type: SystemDouble
Take profit level. - comment (Optional)
- Type: SystemString
Order comment text. Last part of the comment may be changed by server. - magic (Optional)
- Type: SystemInt32
Order magic number. May be used as user defined identifier. - expiration (Optional)
- Type: SystemDateTime
Order expiration time (for pending orders only).
Return Value
Type:
OrderOpened order.
ExceptionsException | Condition |
---|
ServerException | Check exception message for details. |
RequoteException | Server cannot execute order(instant execution) at specified price. Check exception fields for latest server price. |
TradeTimeoutException | No reply from server in TradeTimeout milliseconds. |
See Also