Posted by Mohammad Rahhal, Last modified by Diana Alkouni on 14 September 2020 12:16 PM


Public Function NewSLTPOrder(ByVal Ticket As Integer, ByVal Lots As Double, Optional ByVal SL As Object = "", Optional ByVal TP As Object = "") As CallingResultsEnum


This function used to create manages order at an open position. After NewSLTPOrder method executes the NewSLTPOrderResult event fires.
To get the result from the server after accepted the order you have to consume
OnOrderTrade event


Parameter  Description 
Ticket Open position ticket number to be managed, value of type Integer.
Lots Amount of lots , value of type Double.
SL Stop loss, optional value of type Double.
TP Take profit, optional value of type Double.

Return value

Returns value of type  CallingResultsEnum. If the request sent to the server successfully it will return SuccessResult.


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 (, VTLGeneral.ENUM_SYMBOL_INFO_INTEGER.SYMBOL_PIP_LOCATION)

    point1 = 10^ piploc

    Select_ = ClientCode.PositionSelectByIndex (1)


    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

Back to VTL Server Script Index

(0 vote(s))
Not helpful

Comments (0)
Post a new comment
Full Name:
CAPTCHA Verification 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).

Help Desk Software by Hybrid Solutions