CloseByHedge
Posted by Angham Al-Banawien, Last modified by Mohammad Alawneh on 08 July 2019 12:15 PM

Syntax

CloseByHedge (Ticket1 As long, Ticket2 As Long, Lots As Double)

Description

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

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 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 ) 
'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


Back to VTL Server Script Index

(0 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
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