From 34c78c73c0cc72b31166cb13f186fda3000526c0 Mon Sep 17 00:00:00 2001 From: vdemydiuk Date: Thu, 8 Mar 2018 15:26:29 +0200 Subject: [PATCH 1/5] Started version 1.0.18 (MT5) --- MtApi5/Properties/AssemblyInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MtApi5/Properties/AssemblyInfo.cs b/MtApi5/Properties/AssemblyInfo.cs index 6c9ae86f..2eaad9a8 100755 --- a/MtApi5/Properties/AssemblyInfo.cs +++ b/MtApi5/Properties/AssemblyInfo.cs @@ -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")] -[assembly: AssemblyFileVersion("1.0.17")] +[assembly: AssemblyVersion("1.0.18")] +[assembly: AssemblyFileVersion("1.0.18")] From fe94ec21ded639dd8c52230c245809d75b01cad8 Mon Sep 17 00:00:00 2001 From: vdemydiuk Date: Thu, 8 Mar 2018 15:31:02 +0200 Subject: [PATCH 2/5] Issue #102: fixed long type of result in function SeriesInfoInteger --- MtApi5/MtApi5Client.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MtApi5/MtApi5Client.cs b/MtApi5/MtApi5Client.cs index 7c24ee34..cace0973 100755 --- a/MtApi5/MtApi5Client.cs +++ b/MtApi5/MtApi5Client.cs @@ -611,11 +611,11 @@ namespace MtApi5 ///Symbol name. /// Period. ///Identifier of the requested property, value of the ENUM_SERIES_INFO_INTEGER enumeration. - public int SeriesInfoInteger(string symbolName, ENUM_TIMEFRAMES timeframe, ENUM_SERIES_INFO_INTEGER propId) + public long SeriesInfoInteger(string symbolName, ENUM_TIMEFRAMES timeframe, ENUM_SERIES_INFO_INTEGER propId) { var commandParameters = new ArrayList { symbolName, (int)timeframe, (int)propId }; - return SendCommand(Mt5CommandType.SeriesInfoInteger, commandParameters); + return SendCommand(Mt5CommandType.SeriesInfoInteger, commandParameters); } /// From 0a39b69b15f722d45915db46bff54be35330c801 Mon Sep 17 00:00:00 2001 From: vdemydiuk Date: Thu, 8 Mar 2018 16:22:37 +0200 Subject: [PATCH 3/5] Issue #95: Added default constructors to classes MqlBookInfo, MqlTradeCheckResult --- MtApi5/MqlBookInfo.cs | 11 +++++++---- MtApi5/MqlTradeCheckResult.cs | 19 +++++++++++-------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/MtApi5/MqlBookInfo.cs b/MtApi5/MqlBookInfo.cs index 5a3c1d87..d1e4be8e 100755 --- a/MtApi5/MqlBookInfo.cs +++ b/MtApi5/MqlBookInfo.cs @@ -10,13 +10,16 @@ namespace MtApi5 this.volume = volume; } - public ENUM_BOOK_TYPE type { get; } // Order type from ENUM_BOOK_TYPE enumeration - public double price { get; } // Price - public long volume { get; } // Volume + public MqlBookInfo() + { } + + public ENUM_BOOK_TYPE type { get; set; } // Order type from ENUM_BOOK_TYPE enumeration + public double price { get; set; } // Price + public long volume { get; set; } // Volume public override string ToString() { - return $"{type}|{price}|{volume}"; + return $"type = {type}; price = {price}; volume = {volume}"; } } } diff --git a/MtApi5/MqlTradeCheckResult.cs b/MtApi5/MqlTradeCheckResult.cs index 5b5f5cad..11d18e42 100755 --- a/MtApi5/MqlTradeCheckResult.cs +++ b/MtApi5/MqlTradeCheckResult.cs @@ -4,14 +4,14 @@ namespace MtApi5 { public class MqlTradeCheckResult { - public uint Retcode { get; } // Reply code - public double Balance { get; } // Balance after the execution of the deal - public double Equity { get; } // Equity after the execution of the deal - public double Profit { get; } // Floating profit - public double Margin { get; } // Margin requirements - public double Margin_free { get; } // Free margin - public double Margin_level { get; } // Margin level - public string Comment { get; } // Comment to the reply code (description of the error) + public uint Retcode { get; set; } // Reply code + public double Balance { get; set; } // Balance after the execution of the deal + public double Equity { get; set; } // Equity after the execution of the deal + public double Profit { get; set; } // Floating profit + public double Margin { get; set; } // Margin requirements + public double Margin_free { get; set; } // Free margin + public double Margin_level { get; set; } // Margin level + public string Comment { get; set; } // Comment to the reply code (description of the error) public MqlTradeCheckResult(uint retcode , double balance @@ -32,6 +32,9 @@ namespace MtApi5 Comment = comment; } + public MqlTradeCheckResult() + { } + public override string ToString() { return $"Retcode={Retcode}; Comment={Comment}; Balance={Balance}; Equity={Equity}; Profit={Profit}; Margin={Margin}; Margin_free={Margin_free}; Margin_level={Margin_level}"; From ec6c71607b234c8ab8acb54d1a4640fa21f59d60 Mon Sep 17 00:00:00 2001 From: vdemydiuk Date: Thu, 8 Mar 2018 17:45:22 +0200 Subject: [PATCH 4/5] Issue #96: Implemented function PositionGetTicket in MtApi (MT5) --- MtApi5/Mt5CommandType.cs | 2 +- MtApi5/MtApi5Client.cs | 11 ++++ TestClients/MtApi5TestClient/MainWindow.xaml | 1 + TestClients/MtApi5TestClient/ViewModel.cs | 15 +++++ mq5/MtApi5.ex5 | Bin 540120 -> 540774 bytes mq5/MtApi5.mq5 | 63 ++++++++++++------- 6 files changed, 68 insertions(+), 24 deletions(-) diff --git a/MtApi5/Mt5CommandType.cs b/MtApi5/Mt5CommandType.cs index 535c00f8..22542cb8 100755 --- a/MtApi5/Mt5CommandType.cs +++ b/MtApi5/Mt5CommandType.cs @@ -9,7 +9,6 @@ namespace MtApi5 //OrderSend = 1, OrderCalcMargin = 2, OrderCalcProfit = 3, - //OrderCheck = 4, //OrderSendAsync = 5, PositionsTotal = 6, PositionGetSymbol = 7, @@ -17,6 +16,7 @@ namespace MtApi5 PositionGetDouble = 9, PositionGetInteger = 10, PositionGetString = 11, + PositionGetTicket = 4, OrdersTotal = 12, OrderGetTicket = 13, OrderSelect = 14, diff --git a/MtApi5/MtApi5Client.cs b/MtApi5/MtApi5Client.cs index cace0973..cc4c0dda 100755 --- a/MtApi5/MtApi5Client.cs +++ b/MtApi5/MtApi5Client.cs @@ -280,6 +280,17 @@ namespace MtApi5 return SendCommand(Mt5CommandType.PositionGetString, commandParameters); } + /// + ///The function returns the ticket of a position with the specified index in the list of open positions and automatically selects the position to work with using functions PositionGetDouble, PositionGetInteger, PositionGetString. + /// + ///Identifier of a position property. + public ulong PositionGetTicket(int index) + { + var commandParameters = new ArrayList { index }; + + return SendCommand(Mt5CommandType.PositionGetTicket, commandParameters); + } + /// ///Returns the number of current orders. /// diff --git a/TestClients/MtApi5TestClient/MainWindow.xaml b/TestClients/MtApi5TestClient/MainWindow.xaml index bdbf6e51..efe01736 100755 --- a/TestClients/MtApi5TestClient/MainWindow.xaml +++ b/TestClients/MtApi5TestClient/MainWindow.xaml @@ -240,6 +240,7 @@