Updated functions OrderSendBuy, OrderSendSell. Version 1.0.23

This commit is contained in:
vdemydiuk
2015-12-19 19:57:42 +02:00
parent ae4b884908
commit 31b8412300
6 changed files with 51 additions and 75 deletions
+16 -8
View File
@@ -134,26 +134,34 @@ namespace MtApi
public int OrderSendBuy(string symbol, double volume, int slippage)
{
var commandParameters = new ArrayList { symbol, volume, slippage};
return sendCommand<int>(MtCommandType.OrderSendBuy, commandParameters);
return OrderSendBuy(symbol, volume, slippage, 0, 0, null, 0);
}
public int OrderSendSell(string symbol, double volume, int slippage)
{
var commandParameters = new ArrayList { symbol, volume, slippage };
return sendCommand<int>(MtCommandType.OrderSendSell, commandParameters);
return OrderSendSell(symbol, volume, slippage, 0, 0, null, 0);
}
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);
return OrderSendBuy(symbol, volume, slippage, stoploss, takeprofit, null, 0);
}
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);
return OrderSendSell(symbol, volume, slippage, stoploss, takeprofit, null, 0);
}
public int OrderSendBuy(string symbol, double volume, int slippage, double stoploss, double takeprofit, string comment, int magic)
{
var commandParameters = new ArrayList { symbol, volume, slippage, stoploss, takeprofit, comment, magic };
return sendCommand<int>(MtCommandType.OrderSendBuy, commandParameters);
}
public int OrderSendSell(string symbol, double volume, int slippage, double stoploss, double takeprofit, string comment, int magic)
{
var commandParameters = new ArrayList { symbol, volume, slippage, stoploss, takeprofit, comment, magic };
return sendCommand<int>(MtCommandType.OrderSendSell, commandParameters);
}
public bool OrderClose(int ticket, double lots, double price, int slippage, Color color)
-2
View File
@@ -13,8 +13,6 @@ namespace MtApi
OrderSend = 1,
OrderSendBuy = 1001,
OrderSendSell = 1002,
OrderSendBuyStoplossProfit = 10011,
OrderSendSellStoplossProfit = 10012,
OrderClose = 2,
OrderCloseByCurrentPrice = 152,
OrderCloseBy = 3,
+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.21.0")]
[assembly: AssemblyFileVersion("1.0.21.0")]
[assembly: AssemblyVersion("1.0.23.0")]
[assembly: AssemblyFileVersion("1.0.23.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.21" ?>
<?define ProductVersion="1.0.23" ?>
<?define Manufacturer="DW"?>
<?define ProductPath="..\build\products\$(var.Configuration)\"?>
BIN
View File
Binary file not shown.
+32 -62
View File
@@ -321,10 +321,31 @@ int executeCommand()
PrintParamError("slippage");
}
if (!getDoubleValue(ExpertHandle, 3, stoplossValue))
{
PrintParamError("stoploss");
}
if (!getDoubleValue(ExpertHandle, 4, takeprofitValue))
{
PrintParamError("takeprofit");
}
if (!getStringValue(ExpertHandle, 5, commentValue))
{
PrintParamError("comment");
}
if (!getIntValue(ExpertHandle, 6, magicValue))
{
PrintParamError("magic");
}
priceValue = MarketInfo(symbolValue, MODE_ASK);
if (!sendIntResponse(ExpertHandle, OrderSend(symbolValue, OP_BUY, volumeValue, priceValue
, slippageValue, 0, 0)))
, slippageValue, stoplossValue, takeprofitValue
, commentValue, magicValue)))
{
PrintResponseError("OrderSend");
}
@@ -347,32 +368,6 @@ int executeCommand()
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");
@@ -381,53 +376,28 @@ int executeCommand()
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))
if (!getStringValue(ExpertHandle, 5, commentValue))
{
PrintParamError("stoploss");
PrintParamError("comment");
}
if (!getDoubleValue(ExpertHandle, 4, takeprofitValue))
{
PrintParamError("takeprofit");
}
if (!getIntValue(ExpertHandle, 6, magicValue))
{
PrintParamError("magic");
}
priceValue = MarketInfo(symbolValue, MODE_BID);
if (!sendIntResponse(ExpertHandle, OrderSend(symbolValue, OP_SELL, volumeValue, priceValue
, slippageValue, stoplossValue, takeprofitValue)))
, slippageValue, stoplossValue, takeprofitValue
, commentValue, magicValue)))
{
PrintResponseError("OrderSend");
}
break;
break;
case 2: // OrderClose
if (!getIntValue(ExpertHandle, 0, ticketValue))