Syntax
Public Function NewLimitOrder(vSellBuy As ENUM_TRADE_ACTION, SymbolName As String, vLots As Double, vPrice As Double, Optional vSL As Object="", Optional vTP As Object="",Optional Comment As String ="") As Boolean
Description
This function is used to make a limit order on a given trading symbol name,To get aresult from the server, you have to consume
Parameters
Key | Description |
vSellBuy | Operation type, |
SymbolName | Trading Symbol name, |
vLots | Amount of lots, |
vPrice | Requested limit price, a value of type Double. |
Amount of Stop Loss, an optional value of type Object. | |
Amount of taking Profit, an optional value of type Object. | |
Comment | Optional value of type String used to mark the taken orders in the comment field on the trade list. |
Return value
Returns true if successful, otherwise returns false. In order to get an error, call GetLastError() function.
Sample
Public Sub main () If AccountInfoInteger (ACCOUNT_LOGIN) Then Dim ticket Dim lot Dim Symbol Dim Point Dim piploc Dim Price Dim Ask Lot = 1 price = 20 Symbol = ChartSymbol (0) SymbolInfoDouble cstr (Symbol), SYMBOL_ASK, Ask SymbolInfoInteger cstr (Symbol), SYMBOL_PIP_LOCATION, piploc Point 10^piploc NewLimitOrder (TRADE_ACTION_BUY, Symbol, lot, Ask*Price*Point, "" ,"" ,NEW Limit order by VTL) If GetLastError () <> -1 then AlertMessage ErrorDescription (GetLastError ()) End If End IF End IF End sub
See Also