Syntax
Public Function NewMarketOrder(vSellBuy As ENUM_TRADE_ACTION, SymbolName As String, vLots As Double,Optional Comment As String = "") As Boolean
Description
This function is used to make a new market order at the given trading symbol.To get a result from the server after accepted order,you have to consumeOnOrderTradeevent(when auto broker off)orOnPositionTradeevent (when auto brokeron).
Parameters
Key | Description |
vSellBuy | Operation type, value of typeENUM_TRADE_ACTION. |
SymbolName | Trading symbol name, a value of type String. |
vLots | Amount of lots, A value of type Double. |
Comment | Optional value of type String used to mark the taken orders at the comment field on trade list. |
Return value
Returns true if successfulotherwise, returns false. In order to get an error, call GetLastError() function.
Sample
Public Sub main()If AccountInfoInteger(ACCOUNT_LOGIN) Then ' Check if account is selected.MsgBox NewMarketOrder(TRADE_ACTION_BUY,"EUR/USD",1,"New Market Order") ' Returns True if buy operation was successful.End IfEnd Sub
See Also