mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-16 12:18:09 +00:00
Updated PositionClose function (MT5)
Type of the ticket argument changed to ulong, added optional argument: deviation
This commit is contained in:
@@ -497,9 +497,10 @@ namespace MtApi5
|
|||||||
///Closes a position with the specified ticket.
|
///Closes a position with the specified ticket.
|
||||||
///</summary>
|
///</summary>
|
||||||
///<param name="ticket">Ticket of the closed position.</param>
|
///<param name="ticket">Ticket of the closed position.</param>
|
||||||
public bool PositionClose(int ticket)
|
///<param name="deviation">Maximal deviation from the current price (in points).</param>
|
||||||
|
public bool PositionClose(ulong ticket, ulong deviation = ulong.MaxValue)
|
||||||
{
|
{
|
||||||
var commandParameters = new ArrayList { ticket};
|
var commandParameters = new ArrayList { ticket, deviation };
|
||||||
|
|
||||||
return SendCommand<bool>(Mt5CommandType.PositionClose, commandParameters);
|
return SendCommand<bool>(Mt5CommandType.PositionClose, commandParameters);
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-5
@@ -279,12 +279,14 @@ int executeCommand()
|
|||||||
|
|
||||||
case 64: //PositionClose
|
case 64: //PositionClose
|
||||||
{
|
{
|
||||||
int ticket;
|
ulong ticket;
|
||||||
|
ulong deviation;
|
||||||
CTrade trade;
|
CTrade trade;
|
||||||
|
|
||||||
getIntValue(ExpertHandle, 0, ticket);
|
getULongValue(ExpertHandle, 0, ticket);
|
||||||
|
getULongValue(ExpertHandle, 1, deviation);
|
||||||
sendBooleanResponse(ExpertHandle, trade.PositionClose(ticket));
|
|
||||||
|
sendBooleanResponse(ExpertHandle, trade.PositionClose(ticket, deviation));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user