CloseByHedge (Ticket1 As long, Ticket2 As Long, Lots As Double)
This function is used to close two tickets by hedge after the CloseByHedge method executes with acceptance the CloseOrderResult. To get the result from the server after accepting the order, you have to call OnOrderTrade event.
The first open position ticket number to be closed by the hedge. Value of type is Long.
The second open position ticket number to be closed by the hedge. Value of type is Long.
Lots of value to be closed. Value of type is Double.
Returns value of type CallingResultsEnum. If the request sent to the server successfully, it will return SuccessResult.
Dim Result as VTLGeneral.callingResultsEnum
Dim Select_ as Boolean
Dim TicketNum1 as Integer
Dim lots1 as Double
Dim TicketNum2 as Integer
Dim lots2 as Double
Select_ = ClientCode.PositionSelectByIndex (1)
TicketNum1 = Clientcode.PositionGetInteger (VTLGeneral.ENUM_POSITION_PROPERTY_INTEGER.POSITION_IDENTIFIER)
lots1 =Clientcode.PositionGetDouble (VTLGeneral.ENUM_POSITION_PROPERTY_DOUBLE.POSITION_VOLUME )
Select_ = ClientCode.PositionSelectByIndex (2)
TicketNum2 = Clientcode.PositionGetInteger (VTLGeneral.ENUM_POSITION_PROPERTY_INTEGER.POSITION_IDENTIFIER)
lots2 =Clientcode.PositionGetDouble (VTLGeneral.ENUM_POSITION_PROPERTY_DOUBLE.POSITION_VOLUME )
Result = ClientCode.CloseByHedge (TicketNum1 ,TicketNum2, lots2)
Back to VTL Server Script Index