mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-07-27 18:47:55 +00:00
Added command CloseOrderByCurrentPrice into mtapi 4
This commit is contained in:
@@ -178,6 +178,12 @@ namespace MtApi
|
||||
return OrderCloseBy(ticket, opposite, Color.Empty);
|
||||
}
|
||||
|
||||
public bool OrderCloseByCurrentPrice(int ticket, int slippage)
|
||||
{
|
||||
var commandParameters = new ArrayList { ticket, slippage };
|
||||
return sendCommand<bool>(MtCommandType.OrderCloseByCurrentPrice, commandParameters);
|
||||
}
|
||||
|
||||
public double OrderClosePrice()
|
||||
{
|
||||
return sendCommand<double>(MtCommandType.OrderClosePrice, null);
|
||||
|
||||
@@ -16,10 +16,12 @@ namespace MtApi
|
||||
OrderSendBuyStoplossProfit = 10011,
|
||||
OrderSendSellStoplossProfit = 10012,
|
||||
OrderClose = 2,
|
||||
OrderCloseByCurrentPrice = 152,
|
||||
OrderCloseBy = 3,
|
||||
OrderClosePrice = 4,
|
||||
OrderClosePriceByTicket = 1004,
|
||||
OrderCloseTime = 5,
|
||||
OrderCloseAll = 151,
|
||||
OrderComment = 6,
|
||||
OrderCommission = 7,
|
||||
OrderDelete = 8,
|
||||
@@ -185,7 +187,6 @@ namespace MtApi
|
||||
iTimeArray = 149,
|
||||
|
||||
//
|
||||
RefreshRates = 150,
|
||||
OrderCloseAll = 151
|
||||
RefreshRates = 150
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.20.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.20.0")]
|
||||
[assembly: AssemblyVersion("1.0.21.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.21.0")]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||
<?define ProductName="MtApi" ?>
|
||||
<?define ProductVersion="1.0.20" ?>
|
||||
<?define ProductVersion="1.0.21" ?>
|
||||
<?define Manufacturer="DW"?>
|
||||
<?define ProductPath="..\build\products\$(var.Configuration)\"?>
|
||||
|
||||
|
||||
Binary file not shown.
+40
-8
@@ -459,8 +459,47 @@ int executeCommand()
|
||||
{
|
||||
PrintResponseError("OrderClose");
|
||||
}
|
||||
break;
|
||||
|
||||
case 151: //OrderCloseAll
|
||||
if (!sendBooleanResponse(ExpertHandle, OrderCloseAll()))
|
||||
{
|
||||
PrintResponseError("OrderCloseAll");
|
||||
}
|
||||
break;
|
||||
|
||||
case 152: //OrderCloseByCurrentPrice
|
||||
if (!getIntValue(ExpertHandle, 0, ticketValue))
|
||||
{
|
||||
PrintParamError("ticket");
|
||||
}
|
||||
|
||||
break;
|
||||
if (!getIntValue(ExpertHandle, 1, slippageValue))
|
||||
{
|
||||
PrintParamError("slippage");
|
||||
}
|
||||
|
||||
lotsValue = 0;
|
||||
if (OrderSelect(ticketValue, SELECT_BY_TICKET))
|
||||
{
|
||||
symbolValue = OrderSymbol();
|
||||
lotsValue = OrderLots();
|
||||
if (OrderType() == OP_SELL)
|
||||
{
|
||||
priceValue = MarketInfo(symbolValue, MODE_ASK);
|
||||
}
|
||||
else
|
||||
{
|
||||
priceValue = MarketInfo(symbolValue, MODE_BID);
|
||||
}
|
||||
}
|
||||
|
||||
if (!sendBooleanResponse(ExpertHandle, OrderClose(ticketValue, lotsValue, priceValue, slippageValue)))
|
||||
{
|
||||
PrintResponseError("OrderClose");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 3: // OrderCloseBy
|
||||
if (!getIntValue(ExpertHandle, 0, ticketValue))
|
||||
@@ -3460,13 +3499,6 @@ int executeCommand()
|
||||
}
|
||||
break;
|
||||
|
||||
case 151: //OrderCloseAll
|
||||
if (!sendBooleanResponse(ExpertHandle, OrderCloseAll()))
|
||||
{
|
||||
PrintResponseError("OrderCloseAll");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
Print("Unknown command type = ", commandType);
|
||||
sendVoidResponse(ExpertHandle);
|
||||
|
||||
Reference in New Issue
Block a user