Public Function CloseMultiPositions(PositionIDs As string, Lots As String) As Boolean
This function is used to close multiple market orders at once.To get a result from the server, you have to consume OnOrderTrade event (when auto broker off) or OnPositionTrade event (when auto broker on).
||Position Ticket IDs for all the Positions to be closed separated by commas, a value of type String.
|| Amounts separated by commas (If the amount passed is greater than the available amount, the function will close the entire amount of that position), A value of type String.
Returns true if successful otherwise, returns false. In order to get an error, call GetLastError() function.
The number of the PositionIDs and the number of amounts should be identical. And with the same order that you want to close for those PositionIDs.
Public Sub main ()
If AccountInfoInteger (ACCOUNT_LOGIN) Then
Symbol = ChartSymbol (0)
for I = 1 to positionTotal()
Ticket = PositonGetTicket (I)
PositionSelect Clng (Ticket)
If( GetPositionSymbol() = Symbol) then
Tickets = Ticket & ”,” & Tickets
PositionGetDouble POSITION_AMOUNT, lot
Lots = lot & ”,” & Lots
If CloseMultiPositions(tickets, lots)= false then
Back to VTL Client Script Index