mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-18 13:18:12 +00:00
Added fucntion OrderCloseAll into mt5 api
This commit is contained in:
@@ -466,6 +466,15 @@ namespace MtApi5
|
|||||||
|
|
||||||
return sendCommand<string>(Mt5CommandType.HistoryDealGetString, commandParameters);
|
return sendCommand<string>(Mt5CommandType.HistoryDealGetString, commandParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
///Close all open positions.
|
||||||
|
///</summary>
|
||||||
|
///<param name="ticket">OrderCloseAll</param>
|
||||||
|
public bool OrderCloseAll()
|
||||||
|
{
|
||||||
|
return sendCommand<bool>(Mt5CommandType.OrderCloseAll, null);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Account Information functions
|
#region Account Information functions
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ namespace MtApi5
|
|||||||
SymbolInfoSessionTrade = 59,
|
SymbolInfoSessionTrade = 59,
|
||||||
MarketBookAdd = 60,
|
MarketBookAdd = 60,
|
||||||
MarketBookRelease = 61,
|
MarketBookRelease = 61,
|
||||||
MarketBookGet = 62
|
MarketBookGet = 62,
|
||||||
|
OrderCloseAll = 63
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.7.0")]
|
[assembly: AssemblyVersion("1.0.8.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.7.0")]
|
[assembly: AssemblyFileVersion("1.0.8.0")]
|
||||||
|
|||||||
@@ -13,12 +13,6 @@
|
|||||||
"SccProvider" = "8:"
|
"SccProvider" = "8:"
|
||||||
"Hierarchy"
|
"Hierarchy"
|
||||||
{
|
{
|
||||||
"Entry"
|
|
||||||
{
|
|
||||||
"MsmKey" = "8:_0A948AEB88E843A79E449F2694CEAC4A"
|
|
||||||
"OwnerKey" = "8:_8B9C059CECE541EF9F06C906252E106A"
|
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
|
||||||
}
|
|
||||||
"Entry"
|
"Entry"
|
||||||
{
|
{
|
||||||
"MsmKey" = "8:_26066077D06445DAA7176D267C4A5A5C"
|
"MsmKey" = "8:_26066077D06445DAA7176D267C4A5A5C"
|
||||||
@@ -52,13 +46,13 @@
|
|||||||
"Entry"
|
"Entry"
|
||||||
{
|
{
|
||||||
"MsmKey" = "8:_C28BD2D9EC05E0CCB849ABEEA4360539"
|
"MsmKey" = "8:_C28BD2D9EC05E0CCB849ABEEA4360539"
|
||||||
"OwnerKey" = "8:_A1E29B278F4C4BCAA1195F775A473B52"
|
"OwnerKey" = "8:_8B9C059CECE541EF9F06C906252E106A"
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
"MsmSig" = "8:_UNDEFINED"
|
||||||
}
|
}
|
||||||
"Entry"
|
"Entry"
|
||||||
{
|
{
|
||||||
"MsmKey" = "8:_C28BD2D9EC05E0CCB849ABEEA4360539"
|
"MsmKey" = "8:_C28BD2D9EC05E0CCB849ABEEA4360539"
|
||||||
"OwnerKey" = "8:_8B9C059CECE541EF9F06C906252E106A"
|
"OwnerKey" = "8:_A1E29B278F4C4BCAA1195F775A473B52"
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
"MsmSig" = "8:_UNDEFINED"
|
||||||
}
|
}
|
||||||
"Entry"
|
"Entry"
|
||||||
@@ -70,7 +64,7 @@
|
|||||||
"Entry"
|
"Entry"
|
||||||
{
|
{
|
||||||
"MsmKey" = "8:_UNDEFINED"
|
"MsmKey" = "8:_UNDEFINED"
|
||||||
"OwnerKey" = "8:_A1E29B278F4C4BCAA1195F775A473B52"
|
"OwnerKey" = "8:_C28BD2D9EC05E0CCB849ABEEA4360539"
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
"MsmSig" = "8:_UNDEFINED"
|
||||||
}
|
}
|
||||||
"Entry"
|
"Entry"
|
||||||
@@ -82,7 +76,7 @@
|
|||||||
"Entry"
|
"Entry"
|
||||||
{
|
{
|
||||||
"MsmKey" = "8:_UNDEFINED"
|
"MsmKey" = "8:_UNDEFINED"
|
||||||
"OwnerKey" = "8:_C28BD2D9EC05E0CCB849ABEEA4360539"
|
"OwnerKey" = "8:_A1E29B278F4C4BCAA1195F775A473B52"
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
"MsmSig" = "8:_UNDEFINED"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -217,11 +211,6 @@
|
|||||||
"AssemblyAsmDisplayName" = "8:MTApiService, Version=1.0.13.0, Culture=neutral, PublicKeyToken=704b91b7000ff499, processorArchitecture=MSIL"
|
"AssemblyAsmDisplayName" = "8:MTApiService, Version=1.0.13.0, Culture=neutral, PublicKeyToken=704b91b7000ff499, processorArchitecture=MSIL"
|
||||||
"ScatterAssemblies"
|
"ScatterAssemblies"
|
||||||
{
|
{
|
||||||
"_C28BD2D9EC05E0CCB849ABEEA4360539"
|
|
||||||
{
|
|
||||||
"Name" = "8:MTApiService.dll"
|
|
||||||
"Attributes" = "3:512"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
"SourcePath" = "8:MTApiService.dll"
|
"SourcePath" = "8:MTApiService.dll"
|
||||||
"TargetName" = "8:"
|
"TargetName" = "8:"
|
||||||
@@ -352,15 +341,15 @@
|
|||||||
{
|
{
|
||||||
"Name" = "8:Microsoft Visual Studio"
|
"Name" = "8:Microsoft Visual Studio"
|
||||||
"ProductName" = "8:MtApi5"
|
"ProductName" = "8:MtApi5"
|
||||||
"ProductCode" = "8:{564F64AB-717A-46FC-AE3A-51139ADF5EE0}"
|
"ProductCode" = "8:{02DC498A-5F06-4134-BD32-C5D677B8017A}"
|
||||||
"PackageCode" = "8:{BEF87E05-9C6D-4CEB-9D91-FBFFA4AE28C1}"
|
"PackageCode" = "8:{23755B17-D96D-4C2C-A6BD-D3E136A8992E}"
|
||||||
"UpgradeCode" = "8:{5673F99F-74B5-4D75-9648-3250C9B492FB}"
|
"UpgradeCode" = "8:{5673F99F-74B5-4D75-9648-3250C9B492FB}"
|
||||||
"AspNetVersion" = "8:4.0.30319.0"
|
"AspNetVersion" = "8:4.0.30319.0"
|
||||||
"RestartWWWService" = "11:FALSE"
|
"RestartWWWService" = "11:FALSE"
|
||||||
"RemovePreviousVersions" = "11:TRUE"
|
"RemovePreviousVersions" = "11:TRUE"
|
||||||
"DetectNewerInstalledVersion" = "11:TRUE"
|
"DetectNewerInstalledVersion" = "11:TRUE"
|
||||||
"InstallAllUsers" = "11:FALSE"
|
"InstallAllUsers" = "11:FALSE"
|
||||||
"ProductVersion" = "8:1.0.7"
|
"ProductVersion" = "8:1.0.8"
|
||||||
"Manufacturer" = "8:DW"
|
"Manufacturer" = "8:DW"
|
||||||
"ARPHELPTELEPHONE" = "8:"
|
"ARPHELPTELEPHONE" = "8:"
|
||||||
"ARPHELPLINK" = "8:"
|
"ARPHELPLINK" = "8:"
|
||||||
@@ -1047,20 +1036,6 @@
|
|||||||
}
|
}
|
||||||
"MergeModule"
|
"MergeModule"
|
||||||
{
|
{
|
||||||
"{CEE29DC0-9FBA-4B99-8D47-5BC643D9B626}:_0A948AEB88E843A79E449F2694CEAC4A"
|
|
||||||
{
|
|
||||||
"UseDynamicProperties" = "11:TRUE"
|
|
||||||
"IsDependency" = "11:TRUE"
|
|
||||||
"SourcePath" = "8:Microsoft_VC100_CRT_x64.msm"
|
|
||||||
"Properties"
|
|
||||||
{
|
|
||||||
}
|
|
||||||
"LanguageId" = "3:0"
|
|
||||||
"Exclude" = "11:FALSE"
|
|
||||||
"Folder" = "8:"
|
|
||||||
"Feature" = "8:"
|
|
||||||
"IsolateTo" = "8:"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
"ProjectOutput"
|
"ProjectOutput"
|
||||||
{
|
{
|
||||||
@@ -1094,7 +1069,7 @@
|
|||||||
}
|
}
|
||||||
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_8B9C059CECE541EF9F06C906252E106A"
|
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_8B9C059CECE541EF9F06C906252E106A"
|
||||||
{
|
{
|
||||||
"SourcePath" = "8:..\\x64\\Release\\MT5Connector.dll"
|
"SourcePath" = "8:..\\Release\\MT5Connector.dll"
|
||||||
"TargetName" = "8:"
|
"TargetName" = "8:"
|
||||||
"Tag" = "8:"
|
"Tag" = "8:"
|
||||||
"Folder" = "8:_6185AD4113574BCA9BE89DF5A396A60C"
|
"Folder" = "8:_6185AD4113574BCA9BE89DF5A396A60C"
|
||||||
|
|||||||
@@ -28,13 +28,13 @@
|
|||||||
"Entry"
|
"Entry"
|
||||||
{
|
{
|
||||||
"MsmKey" = "8:_1894B11511EC28CA06BF342E1D467761"
|
"MsmKey" = "8:_1894B11511EC28CA06BF342E1D467761"
|
||||||
"OwnerKey" = "8:_BC617CC9A43A49E8B6CDC49115E4A3BC"
|
"OwnerKey" = "8:_67B77AB154964269BD0C77F69052517C"
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
"MsmSig" = "8:_UNDEFINED"
|
||||||
}
|
}
|
||||||
"Entry"
|
"Entry"
|
||||||
{
|
{
|
||||||
"MsmKey" = "8:_1894B11511EC28CA06BF342E1D467761"
|
"MsmKey" = "8:_1894B11511EC28CA06BF342E1D467761"
|
||||||
"OwnerKey" = "8:_67B77AB154964269BD0C77F69052517C"
|
"OwnerKey" = "8:_BC617CC9A43A49E8B6CDC49115E4A3BC"
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
"MsmSig" = "8:_UNDEFINED"
|
||||||
}
|
}
|
||||||
"Entry"
|
"Entry"
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
"Entry"
|
"Entry"
|
||||||
{
|
{
|
||||||
"MsmKey" = "8:_UNDEFINED"
|
"MsmKey" = "8:_UNDEFINED"
|
||||||
"OwnerKey" = "8:_1894B11511EC28CA06BF342E1D467761"
|
"OwnerKey" = "8:_67B77AB154964269BD0C77F69052517C"
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
"MsmSig" = "8:_UNDEFINED"
|
||||||
}
|
}
|
||||||
"Entry"
|
"Entry"
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
"Entry"
|
"Entry"
|
||||||
{
|
{
|
||||||
"MsmKey" = "8:_UNDEFINED"
|
"MsmKey" = "8:_UNDEFINED"
|
||||||
"OwnerKey" = "8:_67B77AB154964269BD0C77F69052517C"
|
"OwnerKey" = "8:_1894B11511EC28CA06BF342E1D467761"
|
||||||
"MsmSig" = "8:_UNDEFINED"
|
"MsmSig" = "8:_UNDEFINED"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -341,15 +341,15 @@
|
|||||||
{
|
{
|
||||||
"Name" = "8:Microsoft Visual Studio"
|
"Name" = "8:Microsoft Visual Studio"
|
||||||
"ProductName" = "8:MtApi5"
|
"ProductName" = "8:MtApi5"
|
||||||
"ProductCode" = "8:{B374AA70-7936-4A44-AF48-ADF152634A97}"
|
"ProductCode" = "8:{4B2B9BEE-9FB1-4E27-9B5F-0C7DAE61A624}"
|
||||||
"PackageCode" = "8:{8BA7181F-7E81-4114-B5AA-F0806596313B}"
|
"PackageCode" = "8:{743CA117-4184-4A9C-B0F9-298A4D6925DB}"
|
||||||
"UpgradeCode" = "8:{0D37B66D-F57F-4AF8-9AF5-B0EB060D60BE}"
|
"UpgradeCode" = "8:{0D37B66D-F57F-4AF8-9AF5-B0EB060D60BE}"
|
||||||
"AspNetVersion" = "8:4.0.30319.0"
|
"AspNetVersion" = "8:4.0.30319.0"
|
||||||
"RestartWWWService" = "11:FALSE"
|
"RestartWWWService" = "11:FALSE"
|
||||||
"RemovePreviousVersions" = "11:TRUE"
|
"RemovePreviousVersions" = "11:TRUE"
|
||||||
"DetectNewerInstalledVersion" = "11:TRUE"
|
"DetectNewerInstalledVersion" = "11:TRUE"
|
||||||
"InstallAllUsers" = "11:FALSE"
|
"InstallAllUsers" = "11:FALSE"
|
||||||
"ProductVersion" = "8:1.0.7"
|
"ProductVersion" = "8:1.0.8"
|
||||||
"Manufacturer" = "8:DW"
|
"Manufacturer" = "8:DW"
|
||||||
"ARPHELPTELEPHONE" = "8:"
|
"ARPHELPTELEPHONE" = "8:"
|
||||||
"ARPHELPLINK" = "8:"
|
"ARPHELPLINK" = "8:"
|
||||||
|
|||||||
Binary file not shown.
@@ -2,6 +2,7 @@
|
|||||||
#property link ""
|
#property link ""
|
||||||
|
|
||||||
#include <Trade\SymbolInfo.mqh>
|
#include <Trade\SymbolInfo.mqh>
|
||||||
|
#include <trade/trade.mqh>
|
||||||
|
|
||||||
#import "MT5Connector.dll"
|
#import "MT5Connector.dll"
|
||||||
bool initExpert(int expertHandle, string connectionProfile, string symbol, double bid, double ask, string& err);
|
bool initExpert(int expertHandle, string connectionProfile, string symbol, double bid, double ask, string& err);
|
||||||
@@ -1591,6 +1592,17 @@ int executeCommand()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 63: //OrderCloseAll
|
||||||
|
{
|
||||||
|
bool retVal;
|
||||||
|
|
||||||
|
retVal = OrderCloseAll();
|
||||||
|
|
||||||
|
sendBooleanResponse(ExpertHandle, retVal);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Print("Unknown command type = ", commandType);
|
Print("Unknown command type = ", commandType);
|
||||||
sendVoidResponse(ExpertHandle);
|
sendVoidResponse(ExpertHandle);
|
||||||
@@ -1705,3 +1717,14 @@ string ResultToString(bool retVal, datetime from, datetime to)
|
|||||||
|
|
||||||
return strResult;
|
return strResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OrderCloseAll()
|
||||||
|
{
|
||||||
|
CTrade trade;
|
||||||
|
int i = PositionsTotal()-1;
|
||||||
|
while (i >= 0)
|
||||||
|
{
|
||||||
|
if (trade.PositionClose(PositionGetSymbol(i))) i--;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user