Syntax
Public Function NewSLTPOrder(ByVal Ticket As Integer, ByVal Lots As Double, Optional ByVal SL As Object = "", Optional ByVal TP As Object = "") As CallingResultsEnum
Description
This function used to create manages order at an open position. After NewSLTPOrder method executes the NewSLTPOrderResultevent fires.
To get the result from the server after accepted the order you have to consume OnOrderTradeevent
Parameters
Parameter | Description |
Ticket | Open position ticket number to be managed, |
Lots | Amount of |
SL | Stop loss, optional value of type Double. |
TP | Take profit, optional value of type Double. |
Return value
Returns value of typeCallingResultsEnum.If the request sent to the server successfully it will return SuccessResult.
Sample
Public Sub Main () Dim Result as VTLGeneral.callingResultsEnum Dim Sym as VTLGeneral.CSymbol Dim Stoploss as Double = 3 Dim point1 as double = 0 Dim piploc as Integer Dim Select_ as Boolean Dim TicketNum as Integer Dim lots as Double Sym = ClientCode.GetSymbolByID (6) piploc=Clientcode.symbolInfoInteger (Sym.name, VTLGeneral.ENUM_SYMBOL_INFO_INTEGER.SYMBOL_PIP_LOCATION) point1 = 10^ piploc Select_ = ClientCode.PositionSelectByIndex (1) TicketNum = Clientcode.PositionGetInteger (VTLGeneral.ENUM_POSITION_PROPERTY_INTEGER.POSITION_IDENTIFIER) lots =Clientcode.PositionGetInteger (VTLGeneral.ENUM_POSITION_PROPERTY_DOUBLE.POSITION_VOLUME) Result = ClientCode.NewSLTPOrder (TicketNum, lots ,Sym.Bid - Stoploss * point1, 0) GUI.msgDialog (Result) End Sub
See Also