Knowledgebase:
CloseMarketOrder
Posted by Mohammad Rahhal, Last modified by Rawan Al Hourani on 25 October 2017 10:27 AM

Syntax

Public Function CloseMarketOrder(ByRef ticket As string, ByRef lots As Double, ByRef TransTag As String) As CallingResultsEnum

This function closes an open position.The account must be selected to be able to close a market order by a selectAccount method. After CloseMarketOrder method executes the CloseOrderResult event fires.

Parameters

Part Description 
Ticket Ticket number to be closed, value of type String.
lots Amount of lots, value of type Double.
TransTag Optional string value to mark the closing order when the result came from the server.

Return value

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

Sample

 Private Sub Btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn.Click

       'API is a predefined variable as CVertexFXClientAPI
        Dim result As VertexFXClientAPI.CallingResultsEnum
        Dim Pos As VertexFXClientAPI10.COOpenPosition
        Pos = API.OpenPositionByIndex(1)
             result = API.CloseMarketOrder(pos.Ticket,pos.lots,"Close Ticket number" & pos.Ticket)
        MsgBox(result)

End Sub


See Also


VertexFX Client API 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