mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-16 20:28:09 +00:00
Merge branch 'master' of https://github.com/vdemydiuk/mtapi
This commit is contained in:
@@ -475,6 +475,17 @@ namespace MtApi5
|
|||||||
{
|
{
|
||||||
return sendCommand<bool>(Mt5CommandType.OrderCloseAll, null);
|
return sendCommand<bool>(Mt5CommandType.OrderCloseAll, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
///Closes a position with the specified ticket.
|
||||||
|
///</summary>
|
||||||
|
///<param name="ticket">Ticket of the closed position.</param>
|
||||||
|
public bool PositionClose(int ticket)
|
||||||
|
{
|
||||||
|
var commandParameters = new ArrayList { ticket};
|
||||||
|
|
||||||
|
return sendCommand<bool>(Mt5CommandType.PositionClose, commandParameters);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Account Information functions
|
#region Account Information functions
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ namespace MtApi5
|
|||||||
MarketBookAdd = 60,
|
MarketBookAdd = 60,
|
||||||
MarketBookRelease = 61,
|
MarketBookRelease = 61,
|
||||||
MarketBookGet = 62,
|
MarketBookGet = 62,
|
||||||
OrderCloseAll = 63
|
OrderCloseAll = 63,
|
||||||
|
PositionClose = 64
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-1
@@ -227,6 +227,16 @@ int executeCommand()
|
|||||||
sendBooleanResponse(ExpertHandle, retVal);
|
sendBooleanResponse(ExpertHandle, retVal);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 64: //PositionClose
|
||||||
|
{
|
||||||
|
int ticket;
|
||||||
|
CTrade trade;
|
||||||
|
|
||||||
|
getIntValue(ExpertHandle, 0, ticket);
|
||||||
|
|
||||||
|
sendBooleanResponse(ExpertHandle, trade.PositionClose(ticket));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 2: // OrderCalcMargin
|
case 2: // OrderCalcMargin
|
||||||
{
|
{
|
||||||
@@ -1726,4 +1736,4 @@ bool OrderCloseAll()
|
|||||||
if (trade.PositionClose(PositionGetSymbol(i))) i--;
|
if (trade.PositionClose(PositionGetSymbol(i))) i--;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user