From 0c38d375590661fa7a80aca8a0ebc457c8676b8f Mon Sep 17 00:00:00 2001 From: vdemydiuk Date: Wed, 6 Jun 2018 14:24:39 +0300 Subject: [PATCH] Issue #107: Added function PositionCloseAll --- MtApi5/Mt5CommandType.cs | 3 +- MtApi5/MtApi5Client.cs | 9 ++++++ TestClients/MtApi5TestClient/MainWindow.xaml | 2 ++ TestClients/MtApi5TestClient/ViewModel.cs | 8 +++++ mq5/MtApi5.ex5 | Bin 709580 -> 709834 bytes mq5/MtApi5.mq5 | 30 ++++++++++++++++--- 6 files changed, 47 insertions(+), 5 deletions(-) diff --git a/MtApi5/Mt5CommandType.cs b/MtApi5/Mt5CommandType.cs index bde25f2d..3ffd8dbc 100755 --- a/MtApi5/Mt5CommandType.cs +++ b/MtApi5/Mt5CommandType.cs @@ -250,6 +250,7 @@ namespace MtApi5 GlobalVariablesDeleteAll = 157, GlobalVariablesTotal = 158, - UnlockTicks = 159 + UnlockTicks = 159, + PositionCloseAll = 160 } } diff --git a/MtApi5/MtApi5Client.cs b/MtApi5/MtApi5Client.cs index 1e6aee78..d788afdf 100755 --- a/MtApi5/MtApi5Client.cs +++ b/MtApi5/MtApi5Client.cs @@ -521,11 +521,20 @@ namespace MtApi5 /// ///Close all open positions. /// + [Obsolete("OrderCloseAll is deprecated, please use PositionCloseAll instead.")] public bool OrderCloseAll() { return SendCommand(Mt5CommandType.OrderCloseAll, null); } + /// + ///Close all open positions. Returns count of closed positions. + /// + public int PositionCloseAll() + { + return SendCommand(Mt5CommandType.PositionCloseAll, null); + } + /// ///Closes a position with the specified ticket. /// diff --git a/TestClients/MtApi5TestClient/MainWindow.xaml b/TestClients/MtApi5TestClient/MainWindow.xaml index b9383780..996cd4ec 100755 --- a/TestClients/MtApi5TestClient/MainWindow.xaml +++ b/TestClients/MtApi5TestClient/MainWindow.xaml @@ -486,6 +486,7 @@ +