Syntax
CloseByHedge (Ticket1 As long, Ticket2 As Long, Lots As Double)
Description
This function is used to close two tickets by hedge after theCloseByHedge method executes with acceptance theCloseOrderResult.To get the result from the server after accepting the order, you have to callOnOrderTradeevent.
Parameters
Parameter | Description |
tickets |
The first open position ticket number to be closed by the hedge. Value of type is Long. |
ticket2 |
The second open position ticket number to be closed by the hedge. Value of type is Long. |
Amount |
Lots of value to be closed. Value of type is Double. |
Return value
Returns value of type CallingResultsEnum. If the request sent to the server successfully, it will return SuccessResult.
Sample
Dim Result as VTLGeneral.callingResultsEnum Dim Select_ as BooleanDim TicketNum1 as Integer Dim lots1 as DoubleDim TicketNum2 as Integer Dim lots2 as DoubleSelect_ = ClientCode.PositionSelectByIndex (1)TicketNum1 = Clientcode.PositionGetInteger (VTLGeneral.ENUM_POSITION_PROPERTY_INTEGER.POSITION_IDENTIFIER)lots1 =Clientcode.PositionGetDouble (VTLGeneral.ENUM_POSITION_PROPERTY_DOUBLE.POSITION_VOLUME ) 'GUI.MsgDialog(TicketNum1)'GUI.MsgDialog(lots1)Select_ = ClientCode.PositionSelectByIndex (2)TicketNum2 = Clientcode.PositionGetInteger (VTLGeneral.ENUM_POSITION_PROPERTY_INTEGER.POSITION_IDENTIFIER)lots2 =Clientcode.PositionGetDouble (VTLGeneral.ENUM_POSITION_PROPERTY_DOUBLE.POSITION_VOLUME ) GUI.MsgDialog(TicketNum2)GUI.MsgDialog(lots2)Result = ClientCode.CloseByHedge (TicketNum1 ,TicketNum2, lots2)GUI.MsgDialog(Result)
See Also