Version matapi4 1.0.20. Added OrderSendBuy, OrderSendSell

This commit is contained in:
vdemydiuk
2015-11-17 12:50:43 +02:00
parent aa7592ebd1
commit f1a8d83c3b
9 changed files with 157 additions and 5 deletions
Regular → Executable
View File
Regular → Executable
View File
+2 -2
View File
@@ -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.17.0")]
[assembly: AssemblyFileVersion("1.0.17.0")]
[assembly: AssemblyVersion("1.0.18.0")]
[assembly: AssemblyFileVersion("1.0.18.0")]
+24
View File
@@ -132,6 +132,30 @@ namespace MtApi
return 0;
}
public int OrderSendBuy(string symbol, double volume, int slippage)
{
var commandParameters = new ArrayList { symbol, volume, slippage};
return sendCommand<int>(MtCommandType.OrderSendBuy, commandParameters);
}
public int OrderSendSell(string symbol, double volume, int slippage)
{
var commandParameters = new ArrayList { symbol, volume, slippage };
return sendCommand<int>(MtCommandType.OrderSendSell, commandParameters);
}
public int OrderSendBuy(string symbol, double volume, int slippage, double stoploss, double takeprofit)
{
var commandParameters = new ArrayList { symbol, volume, slippage, stoploss, takeprofit };
return sendCommand<int>(MtCommandType.OrderSendBuyStoplossProfit, commandParameters);
}
public int OrderSendSell(string symbol, double volume, int slippage, double stoploss, double takeprofit)
{
var commandParameters = new ArrayList { symbol, volume, slippage, stoploss, takeprofit };
return sendCommand<int>(MtCommandType.OrderSendSellStoplossProfit, commandParameters);
}
public bool OrderClose(int ticket, double lots, double price, int slippage, Color color)
{
var commandParameters = new ArrayList { ticket, lots, price, slippage, MtApiColorConverter.ConvertToMtColor(color) };
+4
View File
@@ -11,6 +11,10 @@ namespace MtApi
//trade operations
OrderSend = 1,
OrderSendBuy = 1001,
OrderSendSell = 1002,
OrderSendBuyStoplossProfit = 10011,
OrderSendSellStoplossProfit = 10012,
OrderClose = 2,
OrderCloseBy = 3,
OrderClosePrice = 4,
+2 -2
View File
@@ -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.19.0")]
[assembly: AssemblyFileVersion("1.0.19.0")]
[assembly: AssemblyVersion("1.0.20.0")]
[assembly: AssemblyFileVersion("1.0.20.0")]
+1 -1
View File
@@ -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.19" ?>
<?define ProductVersion="1.0.20" ?>
<?define Manufacturer="DW"?>
<?define ProductPath="..\build\products\$(var.Configuration)\"?>
BIN
View File
Binary file not shown.
+124
View File
@@ -304,6 +304,130 @@ int executeCommand()
}
break;
case 1001: // OrderSendBuy
if (!getStringValue(ExpertHandle, 0, symbolValue))
{
PrintParamError("symbol");
}
if (!getDoubleValue(ExpertHandle, 1, volumeValue))
{
PrintParamError("volume");
}
if (!getIntValue(ExpertHandle, 2, slippageValue))
{
PrintParamError("slippage");
}
priceValue = MarketInfo(symbolValue, MODE_ASK);
if (!sendIntResponse(ExpertHandle, OrderSend(symbolValue, OP_BUY, volumeValue, priceValue
, slippageValue, 0, 0)))
{
PrintResponseError("OrderSend");
}
break;
case 1002: // OrderSendSell
if (!getStringValue(ExpertHandle, 0, symbolValue))
{
PrintParamError("symbol");
}
if (!getDoubleValue(ExpertHandle, 1, volumeValue))
{
PrintParamError("volume");
}
if (!getIntValue(ExpertHandle, 2, slippageValue))
{
PrintParamError("slippage");
}
priceValue = MarketInfo(symbolValue, MODE_BID);
if (!sendIntResponse(ExpertHandle, OrderSend(symbolValue, OP_SELL, volumeValue, priceValue
, slippageValue, 0, 0)))
{
PrintResponseError("OrderSend");
}
break;
case 10011: // OrderSendBuy (stoploss and profit)
if (!getStringValue(ExpertHandle, 0, symbolValue))
{
PrintParamError("symbol");
}
if (!getDoubleValue(ExpertHandle, 1, volumeValue))
{
PrintParamError("volume");
}
if (!getIntValue(ExpertHandle, 2, slippageValue))
{
PrintParamError("slippage");
}
if (!getDoubleValue(ExpertHandle, 3, stoplossValue))
{
PrintParamError("stoploss");
}
if (!getDoubleValue(ExpertHandle, 4, takeprofitValue))
{
PrintParamError("takeprofit");
}
priceValue = MarketInfo(symbolValue, MODE_ASK);
if (!sendIntResponse(ExpertHandle, OrderSend(symbolValue, OP_BUY, volumeValue, priceValue
, slippageValue, stoplossValue, takeprofitValue)))
{
PrintResponseError("OrderSend");
}
break;
case 10012: // OrderSendSell (stoploss and profit)
if (!getStringValue(ExpertHandle, 0, symbolValue))
{
PrintParamError("symbol");
}
if (!getDoubleValue(ExpertHandle, 1, volumeValue))
{
PrintParamError("volume");
}
if (!getIntValue(ExpertHandle, 2, slippageValue))
{
PrintParamError("slippage");
}
if (!getDoubleValue(ExpertHandle, 3, stoplossValue))
{
PrintParamError("stoploss");
}
if (!getDoubleValue(ExpertHandle, 4, takeprofitValue))
{
PrintParamError("takeprofit");
}
priceValue = MarketInfo(symbolValue, MODE_BID);
if (!sendIntResponse(ExpertHandle, OrderSend(symbolValue, OP_SELL, volumeValue, priceValue
, slippageValue, stoplossValue, takeprofitValue)))
{
PrintResponseError("OrderSend");
}
break;
case 2: // OrderClose
if (!getIntValue(ExpertHandle, 0, ticketValue))