Knowledgebase:
CloseMarketOrder
Posted by Mohammad Rahhal, Last modified by Rawan Al Hourani on 16 July 2017 11:37 AM

Syntax

Public Function CloseMarketOrder(ticketID As Long, vLots As Double) As Boolean

This function is used to close the market order by given ticket number.To get a result from the server, you have to consume OnOrderTrade event (when auto broker off) or OnPositionTrade event (when auto broker on).

Parameters

Key Description 
ticketID Position ticket number to be closed, a value of type Long.
vLots Amount of lots, A value of type Double.

Return value

Returns true if successful, otherwise returns false. In order to get an error, call GetLastError() function.

Sample

 Public Sub main ()

  If AccountInfoInteger (ACCOUNT_LOGIN) Then
      Dim ticket
      Dim lot
      Dim Symbol

  Symbol = ChartSymbol (0)
  Ticket = PositonGetTicket (1)
  PositionSelect Clng (Ticket)
  PositionGetDouble POSITION_AMOUNT, lot
  If (GetPositionSymbol () = Symbol) then
  If CloseMarketOrder (ticket, lot) = false then
          AlertMessage ErrorDescription (GetLastError ())
        End IF
      End IF
  End IF

 End sub


See Also


Back to VTL Client 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