diff --git a/MtApi/EnumSymbolInfoDouble.cs b/MtApi/EnumSymbolInfoDouble.cs new file mode 100755 index 00000000..7f44baa3 --- /dev/null +++ b/MtApi/EnumSymbolInfoDouble.cs @@ -0,0 +1,46 @@ +namespace MtApi +{ + // https://docs.mql4.com/constants/environment_state/marketinfoconstants#enum_symbol_info_double + public enum EnumSymbolInfoDouble + { + SYMBOL_BID = 1, // Bid - best sell offer + SYMBOL_BIDHIGH = 2, // Not supported + SYMBOL_BIDLOW = 3, // Not supported + SYMBOL_ASK = 4, // Ask - best buy offer + SYMBOL_ASKHIGH = 5, // Not supported + SYMBOL_ASKLOW = 6, // Not supported + SYMBOL_LAST = 7, // Not supported + SYMBOL_LASTHIGH = 8, // Not supported + SYMBOL_LASTLOW = 9, // Not supported + SYMBOL_POINT = 16, // Symbol point value + SYMBOL_TRADE_TICK_VALUE = 26, // Value of SYMBOL_TRADE_TICK_VALUE_PROFIT + SYMBOL_TRADE_TICK_VALUE_PROFIT = 53, // Not supported + SYMBOL_TRADE_TICK_VALUE_LOSS = 54, // Not supported + SYMBOL_TRADE_TICK_SIZE = 27, // Minimal price change + SYMBOL_TRADE_CONTRACT_SIZE = 28, // Trade contract size + SYMBOL_VOLUME_MIN = 34, // Minimal volume for a deal + SYMBOL_VOLUME_MAX = 35, // Maximal volume for a deal + SYMBOL_VOLUME_STEP = 36, // Minimal volume change step for deal execution + SYMBOL_VOLUME_LIMIT = 55, // Not supported + SYMBOL_SWAP_LONG = 38, // Buy order swap value + SYMBOL_SWAP_SHORT = 39, // Sell order swap value + SYMBOL_MARGIN_INITIAL = 42, // Initial margin means the amount in the margin currency required for opening an order with the volume of one lot. It is used for checking a client's assets when he or she enters the market. + SYMBOL_MARGIN_MAINTENANCE = 43, // The maintenance margin. If it is set, it sets the margin amount in the margin currency of the symbol, charged from one lot. It is used for checking a client's assets when his/her account state changes. If the maintenance margin is equal to 0, the initial margin is used. + SYMBOL_MARGIN_LONG = 44, // Not supported + SYMBOL_MARGIN_SHORT = 45, // Not supported + SYMBOL_MARGIN_LIMIT = 46, // Not supported + SYMBOL_MARGIN_STOP = 47, // Not supported + SYMBOL_MARGIN_STOPLIMIT = 48, // Not supported + SYMBOL_SESSION_VOLUME = 57, // Not supported + SYMBOL_SESSION_TURNOVER = 58, // Not supported + SYMBOL_SESSION_INTEREST = 59, // Not supported + SYMBOL_SESSION_BUY_ORDERS_VOLUME = 61, // Not supported + SYMBOL_SESSION_SELL_ORDERS_VOLUME = 63, // Not supported + SYMBOL_SESSION_OPEN = 64, // Not supported + SYMBOL_SESSION_CLOSE = 65, // Not supported + SYMBOL_SESSION_AW = 66, // Not supported + SYMBOL_SESSION_PRICE_SETTLEMENT = 67, // Not supported + SYMBOL_SESSION_PRICE_LIMIT_MIN = 68, // Not supported + SYMBOL_SESSION_PRICE_LIMIT_MAX = 69, // Not supported + } +} \ No newline at end of file diff --git a/MtApi/MarketInfoModeType.cs b/MtApi/MarketInfoModeType.cs index ac4562d7..7ec3b89c 100755 --- a/MtApi/MarketInfoModeType.cs +++ b/MtApi/MarketInfoModeType.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace MtApi +namespace MtApi { public enum MarketInfoModeType { diff --git a/MtApi/MtApi.csproj b/MtApi/MtApi.csproj index 4b3b33ad..1118608b 100755 --- a/MtApi/MtApi.csproj +++ b/MtApi/MtApi.csproj @@ -60,6 +60,7 @@ + @@ -97,6 +98,7 @@ + @@ -105,6 +107,7 @@ + diff --git a/MtApi/MtApiClient.cs b/MtApi/MtApiClient.cs index 55bcf2d2..431ee383 100755 --- a/MtApi/MtApiClient.cs +++ b/MtApi/MtApiClient.cs @@ -658,63 +658,6 @@ namespace MtApi #endregion - #region Symbols - /// - ///Returns the number of available (selected in Market Watch or all) symbols. - /// - ///Request mode. Can be true or false. - /// - ///If the 'selected' parameter is true, the function returns the number of symbols selected in MarketWatch. If the value is false, it returns the total number of all symbols. - /// - public int SymbolsTotal(bool selected) - { - var commandParameters = new ArrayList { selected }; - return SendCommand(MtCommandType.SymbolsTotal, commandParameters); - } - - /// - ///Returns the name of a symbol. - /// - ///Order number of a symbol. - ///Request mode. If the value is true, the symbol is taken from the list of symbols selected in MarketWatch. If the value is false, the symbol is taken from the general list. - /// - ///Value of string type with the symbol name. - /// - public string SymbolName(int pos, bool selected) - { - var commandParameters = new ArrayList { pos, selected }; - return SendCommand(MtCommandType.SymbolName, commandParameters); - } - - /// - ///Selects a symbol in the Market Watch window or removes a symbol from the window. - /// - ///Symbol name - ///Switch. If the value is false, a symbol should be removed from MarketWatch, otherwise a symbol should be selected in this window. A symbol can't be removed if the symbol chart is open, or there are open orders for this symbol. - /// - ///In case of failure returns false. - /// - public bool SymbolSelect(string name, bool select) - { - var commandParameters = new ArrayList { name, select }; - return SendCommand(MtCommandType.SymbolSelect, commandParameters); - } - - /// - ///Returns the corresponding property of a specified symbol. - /// - ///Symbol name - ///Identifier of a symbol property. The value can be one of the values of the EnumSymbolInfoInteger enumeration - /// - ///The value of long type. - /// - public long SymbolInfoInteger(string name, EnumSymbolInfoInteger propId) - { - var commandParameters = new ArrayList { name, (int)propId }; - return SendCommand(MtCommandType.SymbolInfoInteger, commandParameters); - } - #endregion - #region Common Function public void Alert(string msg) @@ -734,12 +677,6 @@ namespace MtApi return SendCommand(MtCommandType.GetTickCount, null); } - public double MarketInfo(string symbol, MarketInfoModeType type) - { - var commandParameters = new ArrayList { symbol, (int)type }; - return SendCommand(MtCommandType.MarketInfo, commandParameters); - } - public int MessageBox(string text, string caption, int flag) { var commandParameters = new ArrayList { text, caption, flag }; @@ -1487,16 +1424,127 @@ namespace MtApi return SendCommand(MtCommandType.TerminalInfoString, commandParameters); } + #endregion + + #region Market Info + + /// + ///Returns various data about securities listed in the "Market Watch" window. + /// + ///Symbol name. + ///Request identifier that defines the type of information to be returned. Can be any of values of request identifiers. + /// + ///Returns various data about securities listed in the "Market Watch" window. + /// + public double MarketInfo(string symbol, MarketInfoModeType type) + { + var commandParameters = new ArrayList { symbol, (int)type }; + return SendCommand(MtCommandType.MarketInfo, commandParameters); + } + + /// + ///Returns the number of available (selected in Market Watch or all) symbols. + /// + ///Request mode. Can be true or false. + /// + ///If the 'selected' parameter is true, the function returns the number of symbols selected in MarketWatch. If the value is false, it returns the total number of all symbols. + /// + public int SymbolsTotal(bool selected) + { + var commandParameters = new ArrayList { selected }; + return SendCommand(MtCommandType.SymbolsTotal, commandParameters); + } + + /// + ///Returns the name of a symbol. + /// + ///Order number of a symbol. + ///Request mode. If the value is true, the symbol is taken from the list of symbols selected in MarketWatch. If the value is false, the symbol is taken from the general list. + /// + ///Value of string type with the symbol name. + /// + public string SymbolName(int pos, bool selected) + { + var commandParameters = new ArrayList { pos, selected }; + return SendCommand(MtCommandType.SymbolName, commandParameters); + } + + /// + ///Selects a symbol in the Market Watch window or removes a symbol from the window. + /// + ///Symbol name + ///Switch. If the value is false, a symbol should be removed from MarketWatch, otherwise a symbol should be selected in this window. A symbol can't be removed if the symbol chart is open, or there are open orders for this symbol. + /// + ///In case of failure returns false. + /// + public bool SymbolSelect(string name, bool select) + { + var commandParameters = new ArrayList { name, select }; + return SendCommand(MtCommandType.SymbolSelect, commandParameters); + } + + /// + ///Returns the corresponding property of a specified symbol. + /// + ///Symbol name + ///Identifier of a symbol property. The value can be one of the values of the EnumSymbolInfoInteger enumeration + /// + ///The value of long type. + /// + public long SymbolInfoInteger(string name, EnumSymbolInfoInteger propId) + { + var commandParameters = new ArrayList { name, (int)propId }; + return SendCommand(MtCommandType.SymbolInfoInteger, commandParameters); + } + + /// + ///Returns the corresponding property of a specified symbol. + /// + ///Symbol name + ///Identifier of a symbol property. The value can be one of the values of the ENUM_SYMBOL_INFO_STRING enumeration. + /// + ///The value of string type. + /// public string SymbolInfoString(string name, ENUM_SYMBOL_INFO_STRING propId) { var commandParameters = new ArrayList { name, (int)propId }; - return SendCommand(MtCommandType.SymbolInfoString, commandParameters); ; + return SendCommand(MtCommandType.SymbolInfoString, commandParameters); } + /// + ///Allows receiving time of beginning and end of the specified quoting/trading sessions for a specified symbol and day of week. + /// + /// + ///Symbol name. + ///Day of the week. + ///Ordinal number of a session, whose beginning and end time we want to receive. Indexing of sessions starts with 0. + ///Session type: Quote, Trade + /// + ///The value session. + /// public MtSession SymbolInfoSession(string symbol, DayOfWeek dayOfWeek, uint index, SessionType type) { var responce = SendRequest(new SessionRequest { Symbol = symbol, DayOfWeek = dayOfWeek, SessionIndex = (int)index, SessionType = type }); - return responce != null ? responce.Session : null; + return responce?.Session; + } + + /// + ///Returns the corresponding property of a specified symbol. + /// + ///Symbol name. + ///Identifier of a symbol property. The value can be one of the values of the ENUM_SYMBOL_INFO_DOUBLE enumeration. + /// + /// The value of double type. + /// + public double SymbolInfoDouble(string symbolName, EnumSymbolInfoDouble propId) + { + var response = SendRequest(new SymbolInfoDoubleRequest + { + SymbolName = symbolName, + PropId = (int)propId + }); + + return response?.Value ?? 0; } #endregion diff --git a/MtApi/MtSession.cs b/MtApi/MtSession.cs index 5a2a7994..d8a99791 100644 --- a/MtApi/MtSession.cs +++ b/MtApi/MtSession.cs @@ -1,29 +1,23 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MtApi -{ - public class MtSession - { - public string Symbol { get; set; } - public DayOfWeek DayOfWeek { get; set; } - public uint Index { get; set; } - public int MtFromTime { get; set; } - public DateTime From - { - get { return MtApiTimeConverter.ConvertFromMtTime(MtFromTime); } - } - public int MtToTime { get; set; } - public DateTime To - { - get { return MtApiTimeConverter.ConvertFromMtTime(MtToTime); } - } - public bool HasData { get; set; } - public SessionType Type { get; set; } - } - - public enum SessionType { Quote, Trade } -} +using System; + +namespace MtApi +{ + public class MtSession + { + public string Symbol { get; set; } + public DayOfWeek DayOfWeek { get; set; } + public uint Index { get; set; } + public int MtFromTime { get; set; } + public DateTime From => MtApiTimeConverter.ConvertFromMtTime(MtFromTime); + public int MtToTime { get; set; } + public DateTime To => MtApiTimeConverter.ConvertFromMtTime(MtToTime); + public bool HasData { get; set; } + public SessionType Type { get; set; } + } + + public enum SessionType + { + Quote, + Trade + } +} diff --git a/MtApi/Requests/RequestType.cs b/MtApi/Requests/RequestType.cs index df2b0892..7f43184c 100644 --- a/MtApi/Requests/RequestType.cs +++ b/MtApi/Requests/RequestType.cs @@ -13,6 +13,7 @@ iCustom = 8, CopyRates = 9, Session = 10, - SeriesInfoInteger = 11 + SeriesInfoInteger = 11, + SymbolInfoDouble = 12 } } \ No newline at end of file diff --git a/MtApi/Requests/SymbolInfoDoubleRequest.cs b/MtApi/Requests/SymbolInfoDoubleRequest.cs new file mode 100755 index 00000000..bf29e24d --- /dev/null +++ b/MtApi/Requests/SymbolInfoDoubleRequest.cs @@ -0,0 +1,12 @@ +using System; + +namespace MtApi.Requests +{ + internal class SymbolInfoDoubleRequest : RequestBase + { + public override RequestType RequestType => RequestType.SymbolInfoDouble; + + public string SymbolName { get; set; } + public int PropId { get; set; } + } +} \ No newline at end of file diff --git a/MtApi/Responses/SymbolInfoDoubleResponse.cs b/MtApi/Responses/SymbolInfoDoubleResponse.cs new file mode 100755 index 00000000..efe27b62 --- /dev/null +++ b/MtApi/Responses/SymbolInfoDoubleResponse.cs @@ -0,0 +1,7 @@ +namespace MtApi.Responses +{ + internal class SymbolInfoDoubleResponse: ResponseBase + { + public double Value { get; set; } + } +} \ No newline at end of file diff --git a/MtApi/TradeOperation.cs b/MtApi/TradeOperation.cs index fe0cd80b..981b7233 100755 --- a/MtApi/TradeOperation.cs +++ b/MtApi/TradeOperation.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace MtApi +namespace MtApi { public enum TradeOperation { diff --git a/TestClients/TestApiClientUI/Form1.Designer.cs b/TestClients/TestApiClientUI/Form1.Designer.cs index 17433f60..6c112682 100644 --- a/TestClients/TestApiClientUI/Form1.Designer.cs +++ b/TestClients/TestApiClientUI/Form1.Designer.cs @@ -110,9 +110,12 @@ this.listBoxAccountInfo = new System.Windows.Forms.ListBox(); this.button4 = new System.Windows.Forms.Button(); this.tabPage4 = new System.Windows.Forms.TabPage(); + this.comboBox6 = new System.Windows.Forms.ComboBox(); + this.label29 = new System.Windows.Forms.Label(); + this.comboBox5 = new System.Windows.Forms.ComboBox(); + this.button31 = new System.Windows.Forms.Button(); this.txtMarketInfoSymbol = new System.Windows.Forms.TextBox(); this.button5 = new System.Windows.Forms.Button(); - this.listBoxMarketInfo = new System.Windows.Forms.ListBox(); this.tabPage5 = new System.Windows.Forms.TabPage(); this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker(); this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker(); @@ -154,8 +157,10 @@ this.button28 = new System.Windows.Forms.Button(); this.label28 = new System.Windows.Forms.Label(); this.textBox1 = new System.Windows.Forms.TextBox(); - this.button31 = new System.Windows.Forms.Button(); - this.comboBox5 = new System.Windows.Forms.ComboBox(); + this.comboBox7 = new System.Windows.Forms.ComboBox(); + this.button33 = new System.Windows.Forms.Button(); + this.label30 = new System.Windows.Forms.Label(); + this.comboBox8 = new System.Windows.Forms.ComboBox(); this.groupBox1.SuspendLayout(); this.statusStrip1.SuspendLayout(); this.groupBox2.SuspendLayout(); @@ -1038,9 +1043,16 @@ // // tabPage4 // + this.tabPage4.Controls.Add(this.comboBox8); + this.tabPage4.Controls.Add(this.label30); + this.tabPage4.Controls.Add(this.button33); + this.tabPage4.Controls.Add(this.comboBox7); + this.tabPage4.Controls.Add(this.comboBox6); + this.tabPage4.Controls.Add(this.label29); + this.tabPage4.Controls.Add(this.comboBox5); + this.tabPage4.Controls.Add(this.button31); this.tabPage4.Controls.Add(this.txtMarketInfoSymbol); this.tabPage4.Controls.Add(this.button5); - this.tabPage4.Controls.Add(this.listBoxMarketInfo); this.tabPage4.Location = new System.Drawing.Point(4, 22); this.tabPage4.Name = "tabPage4"; this.tabPage4.Padding = new System.Windows.Forms.Padding(3); @@ -1049,70 +1061,67 @@ this.tabPage4.Text = "MarketInfo"; this.tabPage4.UseVisualStyleBackColor = true; // + // comboBox6 + // + this.comboBox6.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox6.FormattingEnabled = true; + this.comboBox6.Location = new System.Drawing.Point(229, 10); + this.comboBox6.Name = "comboBox6"; + this.comboBox6.Size = new System.Drawing.Size(121, 21); + this.comboBox6.TabIndex = 27; + // + // label29 + // + this.label29.AutoSize = true; + this.label29.Location = new System.Drawing.Point(164, 13); + this.label29.Name = "label29"; + this.label29.Size = new System.Drawing.Size(59, 13); + this.label29.TabIndex = 26; + this.label29.Text = "TimeFrame"; + // + // comboBox5 + // + this.comboBox5.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox5.FormattingEnabled = true; + this.comboBox5.Items.AddRange(new object[] { + "SERIES_BARS_COUNT", + "SERIES_FIRSTDATE", + "SERIES_LASTBAR_DATE", + "SERIES_SERVER_FIRSTDATE"}); + this.comboBox5.Location = new System.Drawing.Point(13, 74); + this.comboBox5.Name = "comboBox5"; + this.comboBox5.Size = new System.Drawing.Size(186, 21); + this.comboBox5.TabIndex = 25; + // + // button31 + // + this.button31.Location = new System.Drawing.Point(208, 74); + this.button31.Name = "button31"; + this.button31.Size = new System.Drawing.Size(111, 23); + this.button31.TabIndex = 24; + this.button31.Text = "SeriesInfoInteger"; + this.button31.UseVisualStyleBackColor = true; + this.button31.Click += new System.EventHandler(this.button31_Click); + // // txtMarketInfoSymbol // - this.txtMarketInfoSymbol.Location = new System.Drawing.Point(208, 6); + this.txtMarketInfoSymbol.Location = new System.Drawing.Point(57, 10); this.txtMarketInfoSymbol.Name = "txtMarketInfoSymbol"; this.txtMarketInfoSymbol.Size = new System.Drawing.Size(100, 20); this.txtMarketInfoSymbol.TabIndex = 7; // // button5 // - this.button5.Location = new System.Drawing.Point(16, 328); + this.button5.Location = new System.Drawing.Point(208, 45); this.button5.Name = "button5"; - this.button5.Size = new System.Drawing.Size(186, 23); + this.button5.Size = new System.Drawing.Size(111, 23); this.button5.TabIndex = 6; - this.button5.Text = "Execute"; + this.button5.Text = "MarketInfo"; this.button5.UseVisualStyleBackColor = true; this.button5.Click += new System.EventHandler(this.button5_Click); // - // listBoxMarketInfo - // - this.listBoxMarketInfo.FormattingEnabled = true; - this.listBoxMarketInfo.Items.AddRange(new object[] { - "", - "MODE_LOW", - "MODE_HIGH", - "", - "", - "MODE_TIME", - "", - "", - "", - "MODE_BID", - "MODE_ASK", - "MODE_POINT", - "MODE_DIGITS", - "MODE_SPREAD", - "MODE_STOPLEVEL", - "MODE_LOTSIZE", - "MODE_TICKVALUE", - "MODE_TICKSIZE", - "MODE_SWAPLONG", - "MODE_SWAPSHORT", - "MODE_STARTING", - "MODE_EXPIRATION", - "MODE_TRADEALLOWED", - "MODE_MINLOT", - "MODE_LOTSTEP", - "MODE_MAXLOT", - "MODE_SWAPTYPE", - "MODE_PROFITCALCMODE", - "MODE_MARGINCALCMODE", - "MODE_MARGININIT", - "MODE_MARGINMAINTENANCE", - "MODE_MARGINHEDGED", - "MODE_MARGINREQUIRED", - "MODE_FREEZELEVEL"}); - this.listBoxMarketInfo.Location = new System.Drawing.Point(16, 6); - this.listBoxMarketInfo.Name = "listBoxMarketInfo"; - this.listBoxMarketInfo.Size = new System.Drawing.Size(186, 316); - this.listBoxMarketInfo.TabIndex = 5; - // // tabPage5 // - this.tabPage5.Controls.Add(this.comboBox5); - this.tabPage5.Controls.Add(this.button31); this.tabPage5.Controls.Add(this.dateTimePicker2); this.tabPage5.Controls.Add(this.dateTimePicker1); this.tabPage5.Controls.Add(this.label6); @@ -1550,29 +1559,42 @@ this.textBox1.TabIndex = 0; this.textBox1.Text = "EURUSD"; // - // button31 + // comboBox7 // - this.button31.Location = new System.Drawing.Point(287, 298); - this.button31.Name = "button31"; - this.button31.Size = new System.Drawing.Size(128, 23); - this.button31.TabIndex = 22; - this.button31.Text = "SeriesInfoInteger"; - this.button31.UseVisualStyleBackColor = true; - this.button31.Click += new System.EventHandler(this.button31_Click); + this.comboBox7.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox7.FormattingEnabled = true; + this.comboBox7.Location = new System.Drawing.Point(13, 101); + this.comboBox7.Name = "comboBox7"; + this.comboBox7.Size = new System.Drawing.Size(186, 21); + this.comboBox7.TabIndex = 28; // - // comboBox5 + // button33 // - this.comboBox5.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboBox5.FormattingEnabled = true; - this.comboBox5.Items.AddRange(new object[] { - "SERIES_BARS_COUNT", - "SERIES_FIRSTDATE", - "SERIES_LASTBAR_DATE", - "SERIES_SERVER_FIRSTDATE"}); - this.comboBox5.Location = new System.Drawing.Point(160, 298); - this.comboBox5.Name = "comboBox5"; - this.comboBox5.Size = new System.Drawing.Size(121, 21); - this.comboBox5.TabIndex = 23; + this.button33.Location = new System.Drawing.Point(208, 99); + this.button33.Name = "button33"; + this.button33.Size = new System.Drawing.Size(111, 23); + this.button33.TabIndex = 29; + this.button33.Text = "SymbolInfoDouble"; + this.button33.UseVisualStyleBackColor = true; + this.button33.Click += new System.EventHandler(this.button33_Click); + // + // label30 + // + this.label30.AutoSize = true; + this.label30.Location = new System.Drawing.Point(10, 13); + this.label30.Name = "label30"; + this.label30.Size = new System.Drawing.Size(41, 13); + this.label30.TabIndex = 30; + this.label30.Text = "Symbol"; + // + // comboBox8 + // + this.comboBox8.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox8.FormattingEnabled = true; + this.comboBox8.Location = new System.Drawing.Point(13, 47); + this.comboBox8.Name = "comboBox8"; + this.comboBox8.Size = new System.Drawing.Size(186, 21); + this.comboBox8.TabIndex = 31; // // Form1 // @@ -1687,7 +1709,6 @@ private System.Windows.Forms.Label label24; private System.Windows.Forms.TabPage tabPage4; private System.Windows.Forms.Button button5; - private System.Windows.Forms.ListBox listBoxMarketInfo; private System.Windows.Forms.TextBox txtMarketInfoSymbol; private System.Windows.Forms.TabPage tabPage5; private System.Windows.Forms.Button button6; @@ -1746,8 +1767,14 @@ private System.Windows.Forms.Button button30; private System.Windows.Forms.Button button32; private System.Windows.Forms.ComboBox comboBox4; - private System.Windows.Forms.Button button31; private System.Windows.Forms.ComboBox comboBox5; + private System.Windows.Forms.Button button31; + private System.Windows.Forms.ComboBox comboBox6; + private System.Windows.Forms.Label label29; + private System.Windows.Forms.ComboBox comboBox7; + private System.Windows.Forms.Button button33; + private System.Windows.Forms.Label label30; + private System.Windows.Forms.ComboBox comboBox8; } } diff --git a/TestClients/TestApiClientUI/Form1.cs b/TestClients/TestApiClientUI/Form1.cs index 66baf572..e06f7d50 100644 --- a/TestClients/TestApiClientUI/Form1.cs +++ b/TestClients/TestApiClientUI/Form1.cs @@ -28,6 +28,9 @@ namespace TestApiClientUI InitializeComponent(); comboBox3.DataSource = Enum.GetNames(typeof(ENUM_TIMEFRAMES)); + comboBox6.DataSource = Enum.GetNames(typeof(ENUM_TIMEFRAMES)); + comboBox7.DataSource = Enum.GetNames(typeof(EnumSymbolInfoDouble)); + comboBox8.DataSource = Enum.GetNames(typeof(MarketInfoModeType)); _apiClient.QuoteUpdated += apiClient_QuoteUpdated; _apiClient.QuoteAdded += apiClient_QuoteAdded; @@ -721,12 +724,14 @@ namespace TestApiClientUI } } - private void button5_Click(object sender, EventArgs e) + //MarketInfo + private async void button5_Click(object sender, EventArgs e) { - if (listBoxMarketInfo.SelectedIndex < 0) - return; + var symbol = txtMarketInfoSymbol.Text; + MarketInfoModeType propId; + Enum.TryParse(comboBox8.Text, out propId); - var result = _apiClient.MarketInfo(txtMarketInfoSymbol.Text, (MarketInfoModeType)listBoxMarketInfo.SelectedIndex); + var result = await Execute(() => _apiClient.MarketInfo(symbol, propId)); AddToLog($"MarketInfo result: {result}"); } @@ -1227,14 +1232,25 @@ namespace TestApiClientUI //SeriesInfoInteger private async void button31_Click(object sender, EventArgs e) { - var symbol = textBoxSelectedSymbol.Text; + var symbol = txtMarketInfoSymbol.Text; ENUM_TIMEFRAMES timeframes; - Enum.TryParse(comboBox3.Text, out timeframes); + Enum.TryParse(comboBox6.Text, out timeframes); EnumSeriesInfoInteger propId; Enum.TryParse(comboBox5.Text, out propId); var result = await Execute(() => _apiClient.SeriesInfoInteger(symbol, timeframes, propId)); AddToLog($"SeriesInfoInteger: result = {result}"); } + + //SymbolInfoDouble + private async void button33_Click(object sender, EventArgs e) + { + var symbol = txtMarketInfoSymbol.Text; + EnumSymbolInfoDouble propId; + Enum.TryParse(comboBox7.Text, out propId); + + var result = await Execute(() => _apiClient.SymbolInfoDouble(symbol, propId)); + AddToLog($"SymbolInfoDouble: result = {result}"); + } } } diff --git a/mq4/MtApi.ex4 b/mq4/MtApi.ex4 index e55b7d23..4f7e2fa5 100755 Binary files a/mq4/MtApi.ex4 and b/mq4/MtApi.ex4 differ diff --git a/mq4/MtApi.mq4 b/mq4/MtApi.mq4 index 08795a19..7487cb69 100755 Binary files a/mq4/MtApi.mq4 and b/mq4/MtApi.mq4 differ