mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-07-27 18:47:55 +00:00
Version matapi4 1.0.20. Added OrderSendBuy, OrderSendSell
This commit is contained in:
Regular → Executable
@@ -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")]
|
||||
|
||||
@@ -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) };
|
||||
|
||||
@@ -11,6 +11,10 @@ namespace MtApi
|
||||
|
||||
//trade operations
|
||||
OrderSend = 1,
|
||||
OrderSendBuy = 1001,
|
||||
OrderSendSell = 1002,
|
||||
OrderSendBuyStoplossProfit = 10011,
|
||||
OrderSendSellStoplossProfit = 10012,
|
||||
OrderClose = 2,
|
||||
OrderCloseBy = 3,
|
||||
OrderClosePrice = 4,
|
||||
|
||||
@@ -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,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)\"?>
|
||||
|
||||
|
||||
Binary file not shown.
+124
@@ -305,6 +305,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))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user