Compare commits

...

11 Commits

55 changed files with 1114 additions and 538 deletions
-4
View File
@@ -41,10 +41,6 @@ namespace MTApiService
roller.ActivateOptions();
hierarchy.Root.AddAppender(roller);
var memory = new MemoryAppender();
memory.ActivateOptions();
hierarchy.Root.AddAppender(memory);
#if (DEBUG)
hierarchy.Root.Level = Level.Debug;
#else
+2 -2
View File
@@ -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.23.0")]
[assembly: AssemblyFileVersion("1.0.23.0")]
[assembly: AssemblyVersion("1.0.24.0")]
[assembly: AssemblyFileVersion("1.0.24.0")]
+17
View File
@@ -42,6 +42,11 @@ Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "MtApi5Bootstrapper", "MtApi
{A9ED070F-AB4D-4380-9DDE-5D931AC71333} = {A9ED070F-AB4D-4380-9DDE-5D931AC71333}
EndProjectSection
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "MtApiBootstrapper", "MtApiBootstrapper\MtApiBootstrapper.wixproj", "{8E63046B-56E5-4623-8808-558AD72A8F2B}"
ProjectSection(ProjectDependencies) = postProject
{78B94552-DB17-40EC-B7C6-23D32DB85DC1} = {78B94552-DB17-40EC-B7C6-23D32DB85DC1}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -215,6 +220,18 @@ Global
{1497E285-C228-490B-9638-565E118548FB}.Release|x64.ActiveCfg = Release|x64
{1497E285-C228-490B-9638-565E118548FB}.Release|x86.ActiveCfg = Release|x86
{1497E285-C228-490B-9638-565E118548FB}.Release|x86.Build.0 = Release|x86
{8E63046B-56E5-4623-8808-558AD72A8F2B}.Debug|Any CPU.ActiveCfg = Debug|x86
{8E63046B-56E5-4623-8808-558AD72A8F2B}.Debug|Win32.ActiveCfg = Debug|x86
{8E63046B-56E5-4623-8808-558AD72A8F2B}.Debug|Win32.Build.0 = Debug|x86
{8E63046B-56E5-4623-8808-558AD72A8F2B}.Debug|x64.ActiveCfg = Debug|x86
{8E63046B-56E5-4623-8808-558AD72A8F2B}.Debug|x86.ActiveCfg = Debug|x86
{8E63046B-56E5-4623-8808-558AD72A8F2B}.Debug|x86.Build.0 = Debug|x86
{8E63046B-56E5-4623-8808-558AD72A8F2B}.Release|Any CPU.ActiveCfg = Release|x86
{8E63046B-56E5-4623-8808-558AD72A8F2B}.Release|Win32.ActiveCfg = Release|x86
{8E63046B-56E5-4623-8808-558AD72A8F2B}.Release|Win32.Build.0 = Release|x86
{8E63046B-56E5-4623-8808-558AD72A8F2B}.Release|x64.ActiveCfg = Release|x86
{8E63046B-56E5-4623-8808-558AD72A8F2B}.Release|x86.ActiveCfg = Release|x86
{8E63046B-56E5-4623-8808-558AD72A8F2B}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+10
View File
@@ -0,0 +1,10 @@
namespace MtApi
{
public enum EnumSeriesInfoInteger
{
SERIES_BARS_COUNT = 0,
SERIES_FIRSTDATE = 1,
SERIES_LASTBAR_DATE = 5,
SERIES_SERVER_FIRSTDATE = 2
}
}
+46
View File
@@ -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
}
}
+8
View File
@@ -0,0 +1,8 @@
namespace MtApi
{
// https://docs.mql4.com/constants/environment_state/terminalstatus#enum_terminal_info_double
public enum EnumTerminalInfoDouble
{
TERMINAL_COMMUNITY_BALANCE = 25 // Balance in MQL5.community
}
}
+27
View File
@@ -0,0 +1,27 @@
namespace MtApi
{
// https://docs.mql4.com/constants/environment_state/terminalstatus#enum_terminal_info_integer
public enum EnumTerminalInfoInteger
{
TERMINAL_BUILD = 5, // The client terminal build number
TERMINAL_COMMUNITY_ACCOUNT = 23, // The flag indicates the presence of MQL5.community authorization data in the terminal
TERMINAL_COMMUNITY_CONNECTION = 24, // Connection to MQL5.community
TERMINAL_CONNECTED = 6, // Connection to a trade server
TERMINAL_DLLS_ALLOWED = 7, // Permission to use DLL
TERMINAL_TRADE_ALLOWED = 8, // Permission to trade
TERMINAL_EMAIL_ENABLED = 9, // Permission to send e-mails using SMTP-server and login, specified in the terminal settings
TERMINAL_FTP_ENABLED = 10, // Permission to send reports using FTP-server and login, specified in the terminal settings
TERMINAL_NOTIFICATIONS_ENABLED = 26, // Permission to send notifications to smartphone
TERMINAL_MAXBARS = 11, // The maximal bars count on the chart
TERMINAL_MQID = 22, // The flag indicates the presence of MetaQuotes ID data to send Push notifications
TERMINAL_CODEPAGE = 12, // Number of the code page of the language installed in the client terminal
TERMINAL_CPU_CORES = 21, // The number of CPU cores in the system
TERMINAL_DISK_SPACE = 20, // Free disk space for the MQL4\Files folder of the terminal, Mb
TERMINAL_MEMORY_PHYSICAL = 14, // Physical memory in the system, Mb
TERMINAL_MEMORY_TOTAL = 15, // Memory available to the process of the terminal , Mb
TERMINAL_MEMORY_AVAILABLE = 16, // Free memory of the terminal process, Mb
TERMINAL_MEMORY_USED = 17, // Memory used by the terminal , Mb
TERMINAL_SCREEN_DPI = 27, // The resolution of information display on the screen is measured as number of Dots in a line per Inch (DPI). Knowing the parameter value, you can set the size of graphical objects so that they look the same on monitors with different resolution characteristics.
TERMINAL_PING_LAST = 28 // The last known value of a ping to a trade server in microseconds. One second comprises of one million microseconds
}
}
+1 -6
View File
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
namespace MtApi
{
public enum MarketInfoModeType
{
+3 -8
View File
@@ -4,7 +4,7 @@ namespace MtApi.Monitors
public class TimeframeTradeMonitor : TradeMonitor
{
#region Fields
private volatile bool _isStarted = false;
private volatile bool _isStarted;
#endregion
#region ctor
@@ -23,13 +23,8 @@ namespace MtApi.Monitors
// Returns:
// true if PositionMonitor should check orders
// otherwise, false.
public override bool IsStarted
{
get
{
return _isStarted;
}
}
public override bool IsStarted => _isStarted;
#endregion
#region Protected Methods
+6 -15
View File
@@ -13,7 +13,7 @@ namespace MtApi.Monitors
#endregion
#region ctor
public TradeMonitor(MtApiClient apiClient)
protected TradeMonitor(MtApiClient apiClient)
{
if (apiClient == null)
throw new ArgumentNullException(nameof(apiClient));
@@ -73,13 +73,7 @@ namespace MtApi.Monitors
protected abstract void OnMtConnected();
protected abstract void OnMtDisconnected();
public bool IsMtConnected
{
get
{
return _apiClient.ConnectionState == MtConnectionState.Connected;
}
}
public bool IsMtConnected => _apiClient.ConnectionState == MtConnectionState.Connected;
protected void Check()
{
@@ -113,12 +107,12 @@ namespace MtApi.Monitors
prevOrders = _prevOrders;
}
if (_prevOrders != null) //skip checking on first load orders
if (prevOrders != null) //skip checking on first load orders
{
//check open orders
foreach (var order in tradesOrders)
{
if (_prevOrders.Find(a => a.Ticket == order.Ticket) == null)
if (prevOrders.Find(a => a.Ticket == order.Ticket) == null)
{
openedOrders.Add(order);
}
@@ -126,7 +120,7 @@ namespace MtApi.Monitors
//check closed orders
var closeOrdersTemp = new List<MtOrder>();
foreach (var order in _prevOrders)
foreach (var order in prevOrders)
{
if (tradesOrders.Find(a => a.Ticket == order.Ticket) == null)
{
@@ -180,10 +174,7 @@ namespace MtApi.Monitors
_prevOrders = null;
}
Task.Factory.StartNew(() =>
{
Check();
});
Task.Factory.StartNew(Check);
}
#endregion
}
+1 -6
View File
@@ -5,12 +5,7 @@ namespace MtApi
public class MqlRates
{
public int MtTime { get; set; }
public DateTime Time
{
get { return MtApiTimeConverter.ConvertFromMtTime(MtTime); }
}
public DateTime Time => MtApiTimeConverter.ConvertFromMtTime(MtTime);
public double Open { get; set; }
public double High { get; set; }
public double Low { get; set; }
+14
View File
@@ -0,0 +1,14 @@
using System;
namespace MtApi
{
public class MqlTick
{
public int MtTime { get; set; }
public DateTime Time => MtApiTimeConverter.ConvertFromMtTime(MtTime);
public double Bid { get; set; }
public double Ask { get; set; }
public double Last { get; set; }
public ulong Volume { get; set; }
}
}
+11
View File
@@ -59,10 +59,15 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ChartPeriod.cs" />
<Compile Include="EnumSeriesInfoInteger.cs" />
<Compile Include="EnumSymbolInfoDouble.cs" />
<Compile Include="EnumSymbolInfoInteger.cs" />
<Compile Include="EnumTerminalInfoDouble.cs" />
<Compile Include="EnumTerminalInfoInteger.cs" />
<Compile Include="ExtensionMethods.cs" />
<Compile Include="Monitors\AvailabilityOrdersEventArgs.cs" />
<Compile Include="MqlRates.cs" />
<Compile Include="MqlTick.cs" />
<Compile Include="MtConnectionEventArgs.cs" />
<Compile Include="MtConnectionException.cs" />
<Compile Include="MtConnectionState.cs" />
@@ -92,16 +97,22 @@
<Compile Include="Requests\OrderDeleteRequest.cs" />
<Compile Include="Requests\OrderModifyRequest.cs" />
<Compile Include="Requests\OrderSendRequest.cs" />
<Compile Include="Requests\SeriesInfoIntegerRequest.cs" />
<Compile Include="Requests\SessionRequest.cs" />
<Compile Include="Requests\RequestBase.cs" />
<Compile Include="Requests\RequestType.cs" />
<Compile Include="Requests\SymbolInfoDoubleRequest.cs" />
<Compile Include="Requests\SymbolInfoTickRequest.cs" />
<Compile Include="Responses\CopyRatesResponse.cs" />
<Compile Include="Responses\GetOrderResponse.cs" />
<Compile Include="Responses\GetOrdersResponse.cs" />
<Compile Include="Responses\ICustomResponse.cs" />
<Compile Include="Responses\OrderSendResponse.cs" />
<Compile Include="Responses\SeriesInfoIntegerResponse.cs" />
<Compile Include="Responses\SessionResponse.cs" />
<Compile Include="Responses\ResponseBase.cs" />
<Compile Include="Responses\SymbolInfoDoubleResponse.cs" />
<Compile Include="Responses\SymbolInfoTickResponse.cs" />
<Compile Include="SeriesIdentifier.cs" />
<Compile Include="TimeBarArgs.cs" />
<Compile Include="Monitors\TimeframeTradeMonitor.cs" />
+308 -92
View File
@@ -498,83 +498,241 @@ namespace MtApi
}
#endregion
#region Check Status
#region Checkup
///<summary>
///Returns the contents of the system variable _LastError.
///After the function call, the contents of _LastError are reset.
///</summary>
///<returns>
///Returns the value of the last error that occurred during the execution of an mql4 program.
///</returns>
public int GetLastError()
{
return SendCommand<int>(MtCommandType.GetLastError, null);
}
///<summary>
///Checks connection between client terminal and server.
///</summary>
///<returns>
///It returns true if connection to the server was successfully established, otherwise, it returns false.
///</returns>
public bool IsConnected()
{
return SendCommand<bool>(MtCommandType.IsConnected, null);
}
///<summary>
///Checks if the Expert Advisor runs on a demo account.
///</summary>
///<returns>
///Returns true if the Expert Advisor runs on a demo account, otherwise returns false.
///</returns>
public bool IsDemo()
{
return SendCommand<bool>(MtCommandType.IsDemo, null);
}
///<summary>
///Checks if the DLL function call is allowed for the Expert Advisor.
///</summary>
///<returns>
///Returns true if the DLL function call is allowed for the Expert Advisor, otherwise returns false.
///</returns>
public bool IsDllsAllowed()
{
return SendCommand<bool>(MtCommandType.IsDllsAllowed, null);
}
///<summary>
///Checks if Expert Advisors are enabled for running.
///</summary>
///<returns>
///Returns true if Expert Advisors are enabled for running, otherwise returns false.
///</returns>
public bool IsExpertEnabled()
{
return SendCommand<bool>(MtCommandType.IsExpertEnabled, null);
}
///<summary>
///Checks if the Expert Advisor can call library function.
///</summary>
///<returns>
///Returns true if the Expert Advisor can call library function, otherwise returns false.
///</returns>
public bool IsLibrariesAllowed()
{
return SendCommand<bool>(MtCommandType.IsLibrariesAllowed, null);
}
///<summary>
///Checks if Expert Advisor runs in the Strategy Tester optimization mode.
///</summary>
///<returns>
///Returns true if Expert Advisor runs in the Strategy Tester optimization mode, otherwise returns false.
///</returns>
public bool IsOptimization()
{
return SendCommand<bool>(MtCommandType.IsOptimization, null);
}
///<summary>
///Checks the forced shutdown of an mql4 program.
///</summary>
///<returns>
///Returns true, if the _StopFlag system variable contains a value other than 0.
///A nonzero value is written into _StopFlag, if a mql4 program has been commanded to complete its operation.
///In this case, you must immediately terminate the program, otherwise the program will be completed
///forcibly from the outside after 3 seconds.
///</returns>
public bool IsStopped()
{
return SendCommand<bool>(MtCommandType.IsStopped, null);
}
///<summary>
///Checks if the Expert Advisor runs in the testing mode.
///</summary>
///<returns>
///Returns true if the Expert Advisor runs in the testing mode, otherwise returns false.
///</returns>
public bool IsTesting()
{
return SendCommand<bool>(MtCommandType.IsTesting, null);
}
///<summary>
///Checks if the Expert Advisor is allowed to trade and trading context is not busy.
///</summary>
///<returns>
///Returns true if the Expert Advisor is allowed to trade and trading context is not busy, otherwise returns false.
///</returns>
public bool IsTradeAllowed()
{
return SendCommand<bool>(MtCommandType.IsTradeAllowed, null);
}
///<summary>
///Returns the information about trade context.
///</summary>
///<returns>
///Returns true if a thread for trading is occupied by another Expert Advisor, otherwise returns false.
///</returns>
public bool IsTradeContextBusy()
{
return SendCommand<bool>(MtCommandType.IsTradeContextBusy, null);
}
///<summary>
///Checks if the Expert Advisor is tested in visual mode.
///</summary>
///<returns>
///Returns true if the Expert Advisor is tested with checked "Visual Mode" button, otherwise returns false.
///</returns>
public bool IsVisualMode()
{
return SendCommand<bool>(MtCommandType.IsVisualMode, null);
}
///<summary>
///Returns the code of a reason for deinitialization.
///</summary>
///<returns>
///Returns the value of _UninitReason which is formed before OnDeinit() is called.
///Value depends on the reasons that led to deinitialization.
///</returns>
public int UninitializeReason()
{
return SendCommand<int>(MtCommandType.UninitializeReason, null);
}
///<summary>
///Print the error description.
///</summary>
public string ErrorDescription(int errorCode)
{
var commandParameters = new ArrayList { errorCode };
return SendCommand<string>(MtCommandType.ErrorDescription, commandParameters);
}
///<summary>
///Returns the value of a corresponding property of the mql4 program environment.
///</summary>
///<param name="propertyId">Identifier of a property. Can be one of the values of the ENUM_TERMINAL_INFO_STRING enumeration.</param>
///<returns>
///Value of string type.
///</returns>
public string TerminalInfoString(ENUM_TERMINAL_INFO_STRING propertyId)
{
var commandParameters = new ArrayList { (int)propertyId };
return SendCommand<string>(MtCommandType.TerminalInfoString, commandParameters);
}
///<summary>
///Returns the value of a corresponding property of the mql4 program environment.
///</summary>
///<param name="propertyId">Identifier of a property. Can be one of the values of the ENUM_TERMINAL_INFO_INTEGER enumeration.</param>
///<returns>
///Value of int type.
///</returns>
public int TerminalInfoInteger(EnumTerminalInfoInteger propertyId)
{
var commandParameters = new ArrayList { (int)propertyId };
return SendCommand<int>(MtCommandType.TerminalInfoInteger, commandParameters);
}
///<summary>
///Returns the value of a corresponding property of the mql4 program environment.
///</summary>
///<param name="propertyId">Identifier of a property. Can be one of the values of the ENUM_TERMINAL_INFO_DOUBLE enumeration.</param>
///<returns>
///Value of double type.
///</returns>
public double TerminalInfoDouble(EnumTerminalInfoDouble propertyId)
{
var commandParameters = new ArrayList { (int)propertyId };
return SendCommand<double>(MtCommandType.TerminalInfoDouble, commandParameters);
}
///<summary>
///Returns the name of company owning the client terminal.
///</summary>
///<returns>
///The name of company owning the client terminal.
///</returns>
public string TerminalCompany()
{
return SendCommand<string>(MtCommandType.TerminalCompany, null);
}
///<summary>
///Returns client terminal name.
///</summary>
///<returns>
///Client terminal name.
///</returns>
public string TerminalName()
{
return SendCommand<string>(MtCommandType.TerminalName, null);
}
///<summary>
///Returns the directory, from which the client terminal was launched.
///</summary>
///<returns>
///The directory, from which the client terminal was launched.
///</returns>
public string TerminalPath()
{
return SendCommand<string>(MtCommandType.TerminalPath, null);
}
#endregion
#region Account Information
public double AccountBalance()
{
return SendCommand<double>(MtCommandType.AccountBalance, null);
@@ -658,63 +816,6 @@ namespace MtApi
#endregion
#region Symbols
///<summary>
///Returns the number of available (selected in Market Watch or all) symbols.
///</summary>
///<param name="selected">Request mode. Can be true or false.</param>
///<returns>
///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.
///</returns>
public int SymbolsTotal(bool selected)
{
var commandParameters = new ArrayList { selected };
return SendCommand<int>(MtCommandType.SymbolsTotal, commandParameters);
}
///<summary>
///Returns the name of a symbol.
///</summary>
///<param name="pos">Order number of a symbol.</param>
///<param name="selected">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.</param>
///<returns>
///Value of string type with the symbol name.
///</returns>
public string SymbolName(int pos, bool selected)
{
var commandParameters = new ArrayList { pos, selected };
return SendCommand<string>(MtCommandType.SymbolName, commandParameters);
}
///<summary>
///Selects a symbol in the Market Watch window or removes a symbol from the window.
///</summary>
///<param name="name">Symbol name</param>
///<param name="select">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.</param>
///<returns>
///In case of failure returns false.
///</returns>
public bool SymbolSelect(string name, bool select)
{
var commandParameters = new ArrayList { name, select };
return SendCommand<bool>(MtCommandType.SymbolSelect, commandParameters);
}
///<summary>
///Returns the corresponding property of a specified symbol.
///</summary>
///<param name="name">Symbol name</param>
///<param name="propId">Identifier of a symbol property. The value can be one of the values of the EnumSymbolInfoInteger enumeration</param>
///<returns>
///The value of long type.
///</returns>
public long SymbolInfoInteger(string name, EnumSymbolInfoInteger propId)
{
var commandParameters = new ArrayList { name, (int)propId };
return SendCommand<long>(MtCommandType.SymbolInfoInteger, commandParameters);
}
#endregion
#region Common Function
public void Alert(string msg)
@@ -734,12 +835,6 @@ namespace MtApi
return SendCommand<int>(MtCommandType.GetTickCount, null);
}
public double MarketInfo(string symbol, MarketInfoModeType type)
{
var commandParameters = new ArrayList { symbol, (int)type };
return SendCommand<double>(MtCommandType.MarketInfo, commandParameters);
}
public int MessageBox(string text, string caption, int flag)
{
var commandParameters = new ArrayList { text, caption, flag };
@@ -795,25 +890,6 @@ namespace MtApi
#endregion
#region Client Terminal Functions
public string TerminalCompany()
{
return SendCommand<string>(MtCommandType.TerminalCompany, null);
}
public string TerminalName()
{
return SendCommand<string>(MtCommandType.TerminalName, null);
}
public string TerminalPath()
{
return SendCommand<string>(MtCommandType.TerminalPath, null);
}
#endregion
#region Date and Time Functions
public int Day()
@@ -1466,25 +1542,165 @@ namespace MtApi
return response?.Rates;
}
#endregion
#region Checkup
public string TerminalInfoString(ENUM_TERMINAL_INFO_STRING propertyId)
///<summary>
///Returns information about the state of historical data.
///</summary>
///<param name="symbolName">Symbol name.</param>
///<param name="timeframe">Period.</param>
///<param name="propId">Identifier of the requested property, value of the ENUM_SERIES_INFO_INTEGER enumeration.</param>
///<returns>
///Returns value of the long type.
///</returns>
public long SeriesInfoInteger(string symbolName, ENUM_TIMEFRAMES timeframe, EnumSeriesInfoInteger propId)
{
var commandParameters = new ArrayList { (int)propertyId };
return SendCommand<string>(MtCommandType.TerminalInfoString, commandParameters);
var response = SendRequest<SeriesInfoIntegerResponse>(new SeriesInfoIntegerRequest
{
SymbolName = symbolName,
Timeframe = (int)timeframe,
PropId = (int)propId
});
return response?.Value ?? 0;
}
#endregion
#region Market Info
///<summary>
///Returns various data about securities listed in the "Market Watch" window.
///</summary>
///<param name="symbol">Symbol name.</param>
///<param name="type">Request identifier that defines the type of information to be returned. Can be any of values of request identifiers.</param>
///<returns>
///Returns various data about securities listed in the "Market Watch" window.
///</returns>
public double MarketInfo(string symbol, MarketInfoModeType type)
{
var commandParameters = new ArrayList { symbol, (int)type };
return SendCommand<double>(MtCommandType.MarketInfo, commandParameters);
}
///<summary>
///Returns the number of available (selected in Market Watch or all) symbols.
///</summary>
///<param name="selected">Request mode. Can be true or false.</param>
///<returns>
///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.
///</returns>
public int SymbolsTotal(bool selected)
{
var commandParameters = new ArrayList { selected };
return SendCommand<int>(MtCommandType.SymbolsTotal, commandParameters);
}
///<summary>
///Returns the name of a symbol.
///</summary>
///<param name="pos">Order number of a symbol.</param>
///<param name="selected">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.</param>
///<returns>
///Value of string type with the symbol name.
///</returns>
public string SymbolName(int pos, bool selected)
{
var commandParameters = new ArrayList { pos, selected };
return SendCommand<string>(MtCommandType.SymbolName, commandParameters);
}
///<summary>
///Selects a symbol in the Market Watch window or removes a symbol from the window.
///</summary>
///<param name="name">Symbol name</param>
///<param name="select">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.</param>
///<returns>
///In case of failure returns false.
///</returns>
public bool SymbolSelect(string name, bool select)
{
var commandParameters = new ArrayList { name, select };
return SendCommand<bool>(MtCommandType.SymbolSelect, commandParameters);
}
///<summary>
///Returns the corresponding property of a specified symbol.
///</summary>
///<param name="name">Symbol name</param>
///<param name="propId">Identifier of a symbol property. The value can be one of the values of the EnumSymbolInfoInteger enumeration</param>
///<returns>
///The value of long type.
///</returns>
public long SymbolInfoInteger(string name, EnumSymbolInfoInteger propId)
{
var commandParameters = new ArrayList { name, (int)propId };
return SendCommand<long>(MtCommandType.SymbolInfoInteger, commandParameters);
}
///<summary>
///Returns the corresponding property of a specified symbol.
///</summary>
///<param name="name">Symbol name</param>
///<param name="propId">Identifier of a symbol property. The value can be one of the values of the ENUM_SYMBOL_INFO_STRING enumeration.</param>
///<returns>
///The value of string type.
///</returns>
public string SymbolInfoString(string name, ENUM_SYMBOL_INFO_STRING propId)
{
var commandParameters = new ArrayList { name, (int)propId };
return SendCommand<string>(MtCommandType.SymbolInfoString, commandParameters); ;
return SendCommand<string>(MtCommandType.SymbolInfoString, commandParameters);
}
///<summary>
///Allows receiving time of beginning and end of the specified quoting/trading sessions for a specified symbol and day of week.
///
///</summary>
///<param name="symbol">Symbol name.</param>
///<param name="dayOfWeek">Day of the week.</param>
///<param name="index">Ordinal number of a session, whose beginning and end time we want to receive. Indexing of sessions starts with 0.</param>
///<param name="type">Session type: Quote, Trade</param>
///<returns>
///The value session.
///</returns>
public MtSession SymbolInfoSession(string symbol, DayOfWeek dayOfWeek, uint index, SessionType type)
{
var responce = SendRequest<SessionResponse>(new SessionRequest { Symbol = symbol, DayOfWeek = dayOfWeek, SessionIndex = (int)index, SessionType = type });
return responce != null ? responce.Session : null;
return responce?.Session;
}
///<summary>
///Returns the corresponding property of a specified symbol.
///</summary>
///<param name="symbolName">Symbol name.</param>
///<param name="propId">Identifier of a symbol property. The value can be one of the values of the ENUM_SYMBOL_INFO_DOUBLE enumeration.</param>
/// <returns>
/// The value of double type.
/// </returns>
public double SymbolInfoDouble(string symbolName, EnumSymbolInfoDouble propId)
{
var response = SendRequest<SymbolInfoDoubleResponse>(new SymbolInfoDoubleRequest
{
SymbolName = symbolName,
PropId = (int)propId
});
return response?.Value ?? 0;
}
///<summary>
///Returns the corresponding property of a specified symbol.
///</summary>
///<param name="symbol">Symbol name.</param>
/// <returns>
/// MqlTick object, to which the current prices and time of the last price update will be placed.
/// </returns>
public MqlTick SymbolInfoTick(string symbol)
{
var response = SendRequest<SymbolInfoTickResponse>(new SymbolInfoTickRequest
{
Symbol = symbol
});
return response?.Tick;
}
#endregion
+9 -9
View File
@@ -58,9 +58,15 @@ namespace MtApi
IsVisualMode = 37,
UninitializeReason = 38,
ErrorDescription = 39,
TerminalCompany = 68,
TerminalName = 69,
TerminalPath = 70,
TerminalInfoString = 153,
TerminalInfoInteger = 204,
TerminalInfoDouble = 205,
//Account Information
AccountBalance = 40,
AccountBalance = 40,
AccountCredit = 41,
AccountCompany = 42,
AccountCurrency = 43,
@@ -91,11 +97,6 @@ namespace MtApi
SendMail = 66,
Sleep = 67,
//Client Terminal
TerminalCompany = 68,
TerminalName = 69,
TerminalPath = 70,
//Date and Time
Day = 71,
DayOfWeek = 72,
@@ -188,8 +189,6 @@ namespace MtApi
//
RefreshRates = 150,
//
TerminalInfoString = 153,
SymbolInfoString = 154,
//Requests
MtRequest = 155,
@@ -197,7 +196,8 @@ namespace MtApi
//Backtesting
BacktestingReady = 156,
//Symbols
//Market Info
SymbolInfoString = 154,
SymbolsTotal = 200,
SymbolName = 201,
SymbolSelect = 202,
Regular → Executable
+85 -84
View File
@@ -1,5 +1,6 @@
namespace MtApi
{
// https://docs.mql4.com/constants/errorswarnings/errorcodes
public enum MtErrorCode
{
MtApiCustomError = -1, // Error occurred in MtApi.
@@ -10,91 +11,91 @@
ServerBusy = 4, // Trade server is busy.
OldVersion = 5, // Old version of the client terminal.
NoConnection = 6, // No connection with trade server.
NotEnoughRights = 7, // Not enough rights.
TooFrequentRequests = 8, // Too frequent requests.
MalfunctionalTrade = 9, // Malfunctional trade operation.
NotEnoughRights = 7, // Not enough rights.
TooFrequentRequests = 8, // Too frequent requests.
MalfunctionalTrade = 9, // Malfunctional trade operation.
AccountDisabled = 64, // Account disabled.
InvalidAccount = 65, // Invalid account.
TradeTimeout = 128, // Trade timeout.
InvalidPrice = 129, // Invalid price.
InvalidStops = 130, // Invalid stops.
InvalidTradeVolume = 131, // Invalid trade volume.
MarketClosed = 132, // Market is closed.
TradeDisabled = 133, // Trade is disabled.
NotEnoughMoney = 134, // Not enough money.
PriceChanged = 135, // Price changed.
OffQuotes = 136, // Off quotes.
BrokerBusy = 137, // Broker is busy.
Requote = 138, // Requote.
OrderLocked = 139, // Order is locked.
LongPositionsOnlyAllowed = 140, // Long positions only allowed.
TooManyRequests = 141, // Too many requests.
TradeModifyDenied = 145, // Modification denied because an order is too close to market.
TradeContextBusy = 146, // Trade context is busy.
TradeExpirationDenied = 147, // Expirations are denied by broker.
TradeTooManyOrders = 148, // The amount of opened and pending orders has reached the limit set by a broker.
InvalidAccount = 65, // Invalid account.
TradeTimeout = 128, // Trade timeout.
InvalidPrice = 129, // Invalid price.
InvalidStops = 130, // Invalid stops.
InvalidTradeVolume = 131, // Invalid trade volume.
MarketClosed = 132, // Market is closed.
TradeDisabled = 133, // Trade is disabled.
NotEnoughMoney = 134, // Not enough money.
PriceChanged = 135, // Price changed.
OffQuotes = 136, // Off quotes.
BrokerBusy = 137, // Broker is busy.
Requote = 138, // Requote.
OrderLocked = 139, // Order is locked.
LongPositionsOnlyAllowed = 140, // Long positions only allowed.
TooManyRequests = 141, // Too many requests.
TradeModifyDenied = 145, // Modification denied because an order is too close to market.
TradeContextBusy = 146, // Trade context is busy.
TradeExpirationDenied = 147, // Expirations are denied by broker.
TradeTooManyOrders = 148, // The amount of opened and pending orders has reached the limit set by a broker.
NoMqlerror = 4000, // No error.
WrongFunctionPointer = 4001, // Wrong function pointer.
ArrayIndexOutOfRange = 4002, // Array index is out of range.
NoMemoryForFunctionCallStack = 4003, // No memory for function call stack.
RecursiveStackOverflow = 4004, // Recursive stack overflow.
NotEnoughStackForParameter = 4005, // Not enough stack for parameter.
NoMemoryForParameterString = 4006, // No memory for parameter string.
NoMemoryForTempString = 4007, // No memory for temp string.
NotInitializedString = 4008, // Not initialized string.
NotInitializedArraystring = 4009, // Not initialized string in an array.
NoMemoryForArraystring = 4010, // No memory for an array string.
TooLongString = 4011, // Too long string.
RemainderFromZeroDivide = 4012, // Remainder from zero divide.
ZeroDivide = 4013, // Zero divide.
UnknownCommand = 4014, // Unknown command.
WrongJump = 4015, // Wrong jump.
NotInitializedArray = 4016, // Not initialized array.
DllCallsNotAllowed = 4017, // DLL calls are not allowed.
CannotLoadLibrary = 4018, // Cannot load library.
CannotCallFunction = 4019, // Cannot call function.
ExternalExpertCallsNotAllowed = 4020, // EA function calls are not allowed.
NotEnoughMemoryForReturnedString = 4021, // Not enough memory for a string returned from a function.
SystemBusy = 4022, // System is busy.
InvalidFunctionParametersCount = 4050, // Invalid function parameters count.
InvalidFunctionParameterValue = 4051, // Invalid function parameter value.
StringFunctionInternalError = 4052, // String function internal error.
SomeArrayError = 4053, // Some array error.
IncorrectSeriesArrayUsing = 4054, // Incorrect series array using.
CustomIndicatorError = 4055, // Custom indicator error.
IncompatibleArrays = 4056, // Arrays are incompatible.
GlobalVariablesProcessingError = 4057, // Global variables processing error.
GlobalVariableNotFound = 4058, // Global variable not found.
FunctionNotAllowedInTestingMode = 4059, // Function is not allowed in testing mode.
FunctionNotConfirmed = 4060, // Function is not confirmed.
SendMailError = 4061, // Mail sending error.
StringParameterExpected = 4062, // String parameter expected.
IntegerParameterExpected = 4063, // Integer parameter expected.
DoubleParameterExpected = 4064, // Double parameter expected.
ArrayAsParameterExpected = 4065, // Array as parameter expected.
HistoryWillUpdated = 4066, // Requested history data in updating state.
TradeError = 4067, // Some error in trade operation execution.
EndOfFile = 4099, // End of a file.
SomeFileError = 4100, // Some file error.
WrongFileName = 4101, // Wrong file name.
TooManyOpenedFiles = 4102, // Too many opened files.
CannotOpenFile = 4103, // Cannot open file.
IncompatibleAccessToFile = 4104, // Incompatible access to a file.
NoOrderSelected = 4105, // No order selected.
UnknownSymbol = 4106, // Unknown symbol.
InvalidPriceParam = 4107, // Invalid price.
InvalidTicket = 4108, // Invalid ticket.
TradeNotAllowed = 4109, // Trade is not allowed.
LongsNotAllowed = 4110, // Longs are not allowed.
ShortsNotAllowed = 4111, // Shorts are not allowed.
ObjectAlreadyExists = 4200, // Object already exists.
UnknownObjectProperty = 4201, // Unknown object property.
ObjectDoesNotExist = 4202, // Object does not exist.
UnknownObjectType = 4203, // Unknown object type.
NoObjectName = 4204, // No object name.
ObjectCoordinatesError = 4205, // Object coordinates error.
NoSpecifiedSubwindow = 4206, // No specified subwindow.
SomeObjectError = 4207 // Some error in object operation.
NoMqlerror = 4000, // No error.
WrongFunctionPointer = 4001, // Wrong function pointer.
ArrayIndexOutOfRange = 4002, // Array index is out of range.
NoMemoryForFunctionCallStack = 4003, // No memory for function call stack.
RecursiveStackOverflow = 4004, // Recursive stack overflow.
NotEnoughStackForParameter = 4005, // Not enough stack for parameter.
NoMemoryForParameterString = 4006, // No memory for parameter string.
NoMemoryForTempString = 4007, // No memory for temp string.
NotInitializedString = 4008, // Not initialized string.
NotInitializedArraystring = 4009, // Not initialized string in an array.
NoMemoryForArraystring = 4010, // No memory for an array string.
TooLongString = 4011, // Too long string.
RemainderFromZeroDivide = 4012, // Remainder from zero divide.
ZeroDivide = 4013, // Zero divide.
UnknownCommand = 4014, // Unknown command.
WrongJump = 4015, // Wrong jump.
NotInitializedArray = 4016, // Not initialized array.
DllCallsNotAllowed = 4017, // DLL calls are not allowed.
CannotLoadLibrary = 4018, // Cannot load library.
CannotCallFunction = 4019, // Cannot call function.
ExternalExpertCallsNotAllowed = 4020, // EA function calls are not allowed.
NotEnoughMemoryForReturnedString = 4021, // Not enough memory for a string returned from a function.
SystemBusy = 4022, // System is busy.
InvalidFunctionParametersCount = 4050, // Invalid function parameters count.
InvalidFunctionParameterValue = 4051, // Invalid function parameter value.
StringFunctionInternalError = 4052, // String function internal error.
SomeArrayError = 4053, // Some array error.
IncorrectSeriesArrayUsing = 4054, // Incorrect series array using.
CustomIndicatorError = 4055, // Custom indicator error.
IncompatibleArrays = 4056, // Arrays are incompatible.
GlobalVariablesProcessingError = 4057, // Global variables processing error.
GlobalVariableNotFound = 4058, // Global variable not found.
FunctionNotAllowedInTestingMode = 4059, // Function is not allowed in testing mode.
FunctionNotConfirmed = 4060, // Function is not confirmed.
SendMailError = 4061, // Mail sending error.
StringParameterExpected = 4062, // String parameter expected.
IntegerParameterExpected = 4063, // Integer parameter expected.
DoubleParameterExpected = 4064, // Double parameter expected.
ArrayAsParameterExpected = 4065, // Array as parameter expected.
HistoryWillUpdated = 4066, // Requested history data in updating state.
TradeError = 4067, // Some error in trade operation execution.
EndOfFile = 4099, // End of a file.
SomeFileError = 4100, // Some file error.
WrongFileName = 4101, // Wrong file name.
TooManyOpenedFiles = 4102, // Too many opened files.
CannotOpenFile = 4103, // Cannot open file.
IncompatibleAccessToFile = 4104, // Incompatible access to a file.
NoOrderSelected = 4105, // No order selected.
UnknownSymbol = 4106, // Unknown symbol.
InvalidPriceParam = 4107, // Invalid price.
InvalidTicket = 4108, // Invalid ticket.
TradeNotAllowed = 4109, // Trade is not allowed.
LongsNotAllowed = 4110, // Longs are not allowed.
ShortsNotAllowed = 4111, // Shorts are not allowed.
ObjectAlreadyExists = 4200, // Object already exists.
UnknownObjectProperty = 4201, // Unknown object property.
ObjectDoesNotExist = 4202, // Object does not exist.
UnknownObjectType = 4203, // Unknown object type.
NoObjectName = 4204, // No object name.
ObjectCoordinatesError = 4205, // Object coordinates error.
NoSpecifiedSubwindow = 4206, // No specified subwindow.
SomeObjectError = 4207 // Some error in object operation.
}
}
+1 -6
View File
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
namespace MtApi
{
public class MtQuote
{
+23 -29
View File
@@ -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
}
}
+2 -2
View File
@@ -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.31.0")]
[assembly: AssemblyFileVersion("1.0.31.0")]
[assembly: AssemblyVersion("1.0.32.1")]
[assembly: AssemblyFileVersion("1.0.32.1")]
+9 -27
View File
@@ -1,12 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MtApi.Requests
namespace MtApi.Requests
{
public abstract class CopyRatesRequestBase : RequestBase
internal abstract class CopyRatesRequestBase : RequestBase
{
public enum CopyRatesTypeEnum
{
@@ -15,10 +9,7 @@ namespace MtApi.Requests
CopyRates_3 = 3,
}
public override RequestType RequestType
{
get { return RequestType.CopyRates; }
}
public override RequestType RequestType => RequestType.CopyRates;
public abstract CopyRatesTypeEnum CopyRatesType { get; }
@@ -26,34 +17,25 @@ namespace MtApi.Requests
public ENUM_TIMEFRAMES Timeframe { get; set; }
}
public class CopyRates1Request : CopyRatesRequestBase
internal class CopyRates1Request : CopyRatesRequestBase
{
public override CopyRatesTypeEnum CopyRatesType
{
get { return CopyRatesTypeEnum.CopyRates_1; }
}
public override CopyRatesTypeEnum CopyRatesType => CopyRatesTypeEnum.CopyRates_1;
public int StartPos { get; set; }
public int Count { get; set; }
}
public class CopyRates2Request : CopyRatesRequestBase
internal class CopyRates2Request : CopyRatesRequestBase
{
public override CopyRatesTypeEnum CopyRatesType
{
get { return CopyRatesTypeEnum.CopyRates_2; }
}
public override CopyRatesTypeEnum CopyRatesType => CopyRatesTypeEnum.CopyRates_2;
public int StartTime { get; set; }
public int Count { get; set; }
}
public class CopyRates3Request : CopyRatesRequestBase
internal class CopyRates3Request : CopyRatesRequestBase
{
public override CopyRatesTypeEnum CopyRatesType
{
get { return CopyRatesTypeEnum.CopyRates_3; }
}
public override CopyRatesTypeEnum CopyRatesType => CopyRatesTypeEnum.CopyRates_3;
public int StartTime { get; set; }
public int StopTime { get; set; }
+2 -5
View File
@@ -1,14 +1,11 @@
namespace MtApi.Requests
{
public class GetOrderRequest: RequestBase
internal class GetOrderRequest: RequestBase
{
public int Index { get; set; }
public int Select { get; set; }
public int Pool { get; set; }
public override RequestType RequestType
{
get { return RequestType.GetOrder; }
}
public override RequestType RequestType => RequestType.GetOrder;
}
}
+2 -5
View File
@@ -1,12 +1,9 @@
namespace MtApi.Requests
{
public class GetOrdersRequest: RequestBase
internal class GetOrdersRequest: RequestBase
{
public int Pool { get; set; }
public override RequestType RequestType
{
get { return RequestType.GetOrders; }
}
public override RequestType RequestType => RequestType.GetOrders;
}
}
Regular → Executable
+3 -8
View File
@@ -1,10 +1,8 @@
using System;
using System.Collections;
using System.Collections;
namespace MtApi.Requests
{
public class ICustomRequest : RequestBase
internal class ICustomRequest : RequestBase
{
public enum ParametersType
{
@@ -22,9 +20,6 @@ namespace MtApi.Requests
public ArrayList Params { get; set; }
public ParametersType ParamsType { get; set; }
public override RequestType RequestType
{
get { return RequestType.iCustom; }
}
public override RequestType RequestType => RequestType.iCustom;
}
}
+2 -5
View File
@@ -1,15 +1,12 @@
namespace MtApi.Requests
{
public class OrderCloseByRequest: RequestBase
internal class OrderCloseByRequest: RequestBase
{
public int Ticket { get; set; }
public int Opposite { get; set; }
public int? ArrowColor { get; set; }
public override RequestType RequestType
{
get { return RequestType.OrderCloseBy; }
}
public override RequestType RequestType => RequestType.OrderCloseBy;
}
}
+2 -5
View File
@@ -1,6 +1,6 @@
namespace MtApi.Requests
{
public class OrderCloseRequest: RequestBase
internal class OrderCloseRequest: RequestBase
{
public int Ticket { get; set; }
@@ -9,9 +9,6 @@
public int? Slippage { get; set; }
public int? ArrowColor { get; set; }
public override RequestType RequestType
{
get { return RequestType.OrderClose; }
}
public override RequestType RequestType => RequestType.OrderClose;
}
}
+2 -5
View File
@@ -1,14 +1,11 @@
namespace MtApi.Requests
{
public class OrderDeleteRequest: RequestBase
internal class OrderDeleteRequest: RequestBase
{
public int Ticket { get; set; }
public int? ArrowColor { get; set; }
public override RequestType RequestType
{
get { return RequestType.OrderDelete; }
}
public override RequestType RequestType => RequestType.OrderDelete;
}
}
+2 -5
View File
@@ -1,6 +1,6 @@
namespace MtApi.Requests
{
public class OrderModifyRequest: RequestBase
internal class OrderModifyRequest: RequestBase
{
public int Ticket { get; set; }
public double Price { get; set; }
@@ -10,9 +10,6 @@
public int? ArrowColor { get; set; }
public override RequestType RequestType
{
get { return RequestType.OrderModify; }
}
public override RequestType RequestType => RequestType.OrderModify;
}
}
+2 -5
View File
@@ -1,6 +1,6 @@
namespace MtApi.Requests
{
public class OrderSendRequest: RequestBase
internal class OrderSendRequest: RequestBase
{
public string Symbol { get; set; }
public int Cmd { get; set; }
@@ -15,9 +15,6 @@
public int? Expiration { get; set; }
public int? ArrowColor { get; set; }
public override RequestType RequestType
{
get { return RequestType.OrderSend; }
}
public override RequestType RequestType => RequestType.OrderSend;
}
}
+6 -8
View File
@@ -1,9 +1,7 @@
using Newtonsoft.Json;
namespace MtApi.Requests
{
public abstract class RequestBase
namespace MtApi.Requests
{
internal abstract class RequestBase
{
public abstract RequestType RequestType { get; }
}
}
public abstract RequestType RequestType { get; }
}
}
+15 -12
View File
@@ -1,17 +1,20 @@
namespace MtApi.Requests
{
public enum RequestType
internal enum RequestType
{
Unknown = 0,
GetOrder = 1,
GetOrders = 2,
OrderSend = 3,
OrderClose = 4,
OrderCloseBy = 5,
OrderDelete = 6,
OrderModify = 7,
iCustom = 8,
CopyRates = 9,
Session = 10,
Unknown = 0,
GetOrder = 1,
GetOrders = 2,
OrderSend = 3,
OrderClose = 4,
OrderCloseBy = 5,
OrderDelete = 6,
OrderModify = 7,
iCustom = 8,
CopyRates = 9,
Session = 10,
SeriesInfoInteger = 11,
SymbolInfoDouble = 12,
SymbolInfoTick = 13
}
}
+11
View File
@@ -0,0 +1,11 @@
namespace MtApi.Requests
{
internal class SeriesInfoIntegerRequest: RequestBase
{
public override RequestType RequestType => RequestType.SeriesInfoInteger;
public string SymbolName { get; set; }
public int Timeframe { get; set; }
public int PropId { get; set; }
}
}
+2 -5
View File
@@ -2,16 +2,13 @@
namespace MtApi.Requests
{
public class SessionRequest : RequestBase
internal class SessionRequest : RequestBase
{
public string Symbol { get; set; }
public DayOfWeek DayOfWeek { get; set; }
public int SessionIndex { get; set; }
public SessionType SessionType { get; set; }
public override RequestType RequestType
{
get { return RequestType.Session; }
}
public override RequestType RequestType => RequestType.Session;
}
}
+12
View File
@@ -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; }
}
}
+9
View File
@@ -0,0 +1,9 @@
namespace MtApi.Requests
{
internal class SymbolInfoTickRequest: RequestBase
{
public override RequestType RequestType => RequestType.SymbolInfoTick;
public string Symbol { get; set; }
}
}
+1 -1
View File
@@ -2,7 +2,7 @@
namespace MtApi.Responses
{
public class CopyRatesResponse: ResponseBase
internal class CopyRatesResponse: ResponseBase
{
public List<MqlRates> Rates { get; set; }
}
+1 -1
View File
@@ -1,6 +1,6 @@
namespace MtApi.Responses
{
public class GetOrderResponse: ResponseBase
internal class GetOrderResponse: ResponseBase
{
public MtOrder Order { get; set; }
}
+1 -1
View File
@@ -2,7 +2,7 @@
namespace MtApi.Responses
{
public class GetOrdersResponse: ResponseBase
internal class GetOrdersResponse: ResponseBase
{
public List<MtOrder> Orders { get; set; }
}
+2 -8
View File
@@ -1,12 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MtApi.Responses
namespace MtApi.Responses
{
public class ICustomResponse: ResponseBase
internal class ICustomResponse: ResponseBase
{
public double Value { get; set; }
}
+1 -1
View File
@@ -1,6 +1,6 @@
namespace MtApi.Responses
{
public class OrderSendResponse: ResponseBase
internal class OrderSendResponse: ResponseBase
{
public int Ticket { get; set; }
}
Regular → Executable
+1 -1
View File
@@ -1,6 +1,6 @@
namespace MtApi.Responses
{
public class ResponseBase
internal class ResponseBase
{
public int ErrorCode { get; set; }
public string ErrorMessage { get; set; }
+7
View File
@@ -0,0 +1,7 @@
namespace MtApi.Responses
{
internal class SeriesInfoIntegerResponse: ResponseBase
{
public long Value { get; set; }
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
namespace MtApi.Responses
{
public class SessionResponse : ResponseBase
internal class SessionResponse : ResponseBase
{
public MtSession Session { get; set; }
}
+7
View File
@@ -0,0 +1,7 @@
namespace MtApi.Responses
{
internal class SymbolInfoDoubleResponse: ResponseBase
{
public double Value { get; set; }
}
}
+7
View File
@@ -0,0 +1,7 @@
namespace MtApi.Responses
{
internal class SymbolInfoTickResponse: ResponseBase
{
public MqlTick Tick { get; set; }
}
}
+1 -6
View File
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MtApi
namespace MtApi
{
public enum TradeOperation
{
+2 -2
View File
@@ -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.11.0")]
[assembly: AssemblyFileVersion("1.0.11.0")]
[assembly: AssemblyVersion("1.0.11.1")]
[assembly: AssemblyFileVersion("1.0.11.1")]
+41
View File
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<?if $(var.Platform) = x64 ?>
<?define VcRedistFileName="vc_redist.x64.exe"?>
<?else ?>
<?define VcRedistFileName="vc_redist.x86.exe"?>
<?endif ?>
<?define MsiSourceFileName="MtApiInstaller.msi"?>
<?define ProductName="!(bind.packageName.MtApiMsi)" ?>
<?define ProductVersion="!(bind.packageVersion.MtApiMsi)" ?>
<?define Manufacturer="!(bind.packageManufacturer.MtApiMsi)" ?>
<Bundle Name="$(var.ProductName) Bootstrapper"
Version="$(var.ProductVersion)"
Manufacturer="$(var.Manufacturer)"
UpgradeCode="8e63046b-56e5-4623-8808-558ad72a8f2b">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication LicenseFile="..\LICENSE.rtf"/>
</BootstrapperApplicationRef>
<Chain>
<ExePackage SourceFile="..\vcredist\$(var.VcRedistFileName)"
Name="Redist\$(var.VcRedistFileName)"
Cache="no"
Compressed="yes"
InstallCommand="/install /quiet /norestart">
<!-- Ignore "Newer version installed" error -->
<ExitCode Value="1638" Behavior="success"/>
</ExePackage>
<MsiPackage Id="MtApiMsi"
SourceFile="..\build\installers\$(var.Configuration)\$(var.MsiSourceFileName)"
Visible="yes"
DisplayInternalUI="yes" />
</Chain>
</Bundle>
</Wix>
+41
View File
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.10</ProductVersion>
<ProjectGuid>8e63046b-56e5-4623-8808-558ad72a8f2b</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>MtApi_Setup</OutputName>
<OutputType>Bundle</OutputType>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>..\build\installers\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>..\build\installers\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="Bundle.wxs" />
</ItemGroup>
<ItemGroup>
<WixExtension Include="WixBalExtension">
<HintPath>$(WixExtDir)\WixBalExtension.dll</HintPath>
<Name>WixBalExtension</Name>
</WixExtension>
</ItemGroup>
<Import Project="$(WixTargetsPath)" />
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Wix.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
+1 -1
View File
@@ -6,7 +6,7 @@
<ProductVersion>3.6</ProductVersion>
<ProjectGuid>{78b94552-db17-40ec-b7c6-23d32db85dc1}</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>MtApiSetup</OutputName>
<OutputName>MtApiInstaller</OutputName>
<OutputType>Package</OutputType>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
+18 -16
View File
@@ -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.31" ?>
<?define ProductVersion=!(bind.FileVersion.MtApi.dll) ?>
<?define Manufacturer="DW"?>
<?define ProductPath="..\build\products\$(var.Configuration)\"?>
@@ -11,15 +11,17 @@
Version="$(var.ProductVersion)"
Manufacturer="$(var.Manufacturer)"
UpgradeCode="4107F5F4-7300-4B45-88CE-63929AF228FA">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<WixVariable Id="WixUILicenseRtf" Value="..\LICENSE.rtf" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="MtApi" Title="$(var.ProductName)" Level="1">
<ComponentGroupRef Id="MtApiComponents"/>
</Feature>
<Feature Id="MTConnector" Title="MT Connector" Level="1">
<ComponentGroupRef Id="MTConnectorComponents"/>
</Feature>
@@ -35,18 +37,18 @@
</InstallExecuteSequence>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="$(var.ProductName)">
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="$(var.ProductName)">
<Directory Id="ExpertFolder" Name="Experts">
<Directory Id="ExpertFolder" Name="Experts">
</Directory>
<Directory Id="GAC" Name="GAC">
</Directory>
</Directory>
</Directory>
</Directory>
<Directory Id="SystemFolder">
@@ -57,7 +59,7 @@
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
@@ -66,7 +68,7 @@
<Component Id="MtApiDll" Directory="INSTALLFOLDER">
<File Id="MtApi.dll" Name="MtApi.dll" KeyPath="yes"
Source="$(var.ProductPath)MtApi.dll" />
<RegistryKey Root="HKLM"
Key="Software\Microsoft\.NetFramework\v4.0.30319\AssemblyFoldersEx\$(var.ProductName)"
Action="createAndRemoveOnUninstall">
@@ -78,7 +80,7 @@
<File Id="GAC_MTApiService.dll" Name="MTApiService.dll" KeyPath="yes"
src="$(var.ProductPath)MTApiService.dll"/>
</Component>-->
<Component Id="NewtonsoftJsondll" Directory="INSTALLFOLDER">
<File Id="Newtonsoft.Json.dll" Name="Newtonsoft.Json.dll" KeyPath="yes"
src="$(var.ProductPath)Newtonsoft.Json.dll"/>
@@ -87,7 +89,7 @@
<Component Id="MtApiExpert" Directory="ExpertFolder">
<File Id="MtApi.ex4" Name="MtApi.ex4" KeyPath="yes"
Source="..\mq4\MtApi.ex4" />
</Component>
</Component>
<Component Id="AppShortcutConnMgr" Guid="*" Directory="ApplicationProgramsFolder">
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
+170 -50
View File
@@ -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,6 +157,15 @@
this.button28 = new System.Windows.Forms.Button();
this.label28 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
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.button34 = new System.Windows.Forms.Button();
this.button35 = new System.Windows.Forms.Button();
this.comboBox9 = new System.Windows.Forms.ComboBox();
this.comboBox10 = new System.Windows.Forms.ComboBox();
this.button36 = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.groupBox2.SuspendLayout();
@@ -1036,9 +1048,21 @@
//
// tabPage4
//
this.tabPage4.Controls.Add(this.button36);
this.tabPage4.Controls.Add(this.comboBox10);
this.tabPage4.Controls.Add(this.comboBox9);
this.tabPage4.Controls.Add(this.button35);
this.tabPage4.Controls.Add(this.button34);
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);
@@ -1047,66 +1071,65 @@
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.dateTimePicker2);
@@ -1546,6 +1569,91 @@
this.textBox1.TabIndex = 0;
this.textBox1.Text = "EURUSD";
//
// comboBox7
//
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;
//
// button33
//
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;
//
// button34
//
this.button34.Location = new System.Drawing.Point(387, 47);
this.button34.Name = "button34";
this.button34.Size = new System.Drawing.Size(112, 23);
this.button34.TabIndex = 32;
this.button34.Text = "SymbolInfoTick";
this.button34.UseVisualStyleBackColor = true;
this.button34.Click += new System.EventHandler(this.button34_Click);
//
// button35
//
this.button35.Location = new System.Drawing.Point(208, 128);
this.button35.Name = "button35";
this.button35.Size = new System.Drawing.Size(111, 23);
this.button35.TabIndex = 33;
this.button35.Text = "TerminalInfoInteger";
this.button35.UseVisualStyleBackColor = true;
this.button35.Click += new System.EventHandler(this.button35_Click);
//
// comboBox9
//
this.comboBox9.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox9.FormattingEnabled = true;
this.comboBox9.Location = new System.Drawing.Point(13, 130);
this.comboBox9.Name = "comboBox9";
this.comboBox9.Size = new System.Drawing.Size(186, 21);
this.comboBox9.TabIndex = 34;
//
// comboBox10
//
this.comboBox10.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox10.FormattingEnabled = true;
this.comboBox10.Location = new System.Drawing.Point(13, 157);
this.comboBox10.Name = "comboBox10";
this.comboBox10.Size = new System.Drawing.Size(186, 21);
this.comboBox10.TabIndex = 35;
//
// button36
//
this.button36.Location = new System.Drawing.Point(208, 157);
this.button36.Name = "button36";
this.button36.Size = new System.Drawing.Size(111, 23);
this.button36.TabIndex = 36;
this.button36.Text = "TerminalInfoDouble";
this.button36.UseVisualStyleBackColor = true;
this.button36.Click += new System.EventHandler(this.button36_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -1659,7 +1767,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;
@@ -1718,6 +1825,19 @@
private System.Windows.Forms.Button button30;
private System.Windows.Forms.Button button32;
private System.Windows.Forms.ComboBox comboBox4;
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;
private System.Windows.Forms.Button button34;
private System.Windows.Forms.Button button35;
private System.Windows.Forms.ComboBox comboBox9;
private System.Windows.Forms.Button button36;
private System.Windows.Forms.ComboBox comboBox10;
}
}
+156 -91
View File
@@ -28,6 +28,11 @@ 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));
comboBox9.DataSource = Enum.GetNames(typeof(EnumTerminalInfoInteger));
comboBox10.DataSource = Enum.GetNames(typeof(EnumTerminalInfoDouble));
_apiClient.QuoteUpdated += apiClient_QuoteUpdated;
_apiClient.QuoteAdded += apiClient_QuoteAdded;
@@ -39,7 +44,9 @@ namespace TestApiClientUI
comboBox1.SelectedIndex = 0;
comboBox2.SelectedIndex = 0;
comboBox3.SelectedIndex = 0;
comboBox4.SelectedIndex = 0;
comboBox5.SelectedIndex = 0;
_timerTradeMonitor = new TimerTradeMonitor(_apiClient) { Interval = 10000 }; // 10 sec
_timerTradeMonitor.AvailabilityOrdersChanged += _tradeMonitor_AvailabilityOrdersChanged;
@@ -118,7 +125,7 @@ namespace TestApiClientUI
var msg =
$"TimeBar: Symbol = {e.TimeBar.Symbol}, OpenTime = {e.TimeBar.OpenTime}, CloseTime = {e.TimeBar.CloseTime}, Open = {e.TimeBar.Open}, Close = {e.TimeBar.Close}, High = {e.TimeBar.High}, Low = {e.TimeBar.Low}";
Console.WriteLine(msg);
AddToLog(msg);
PrintLog(msg);
}
private void apiClient_QuoteUpdated(object sender, string symbol, double bid, double ask)
@@ -276,7 +283,7 @@ namespace TestApiClientUI
sendedOrders.Add(orderId);
}
AddToLog($"Closed order result: {result}, ticketId = {orderId}, volume - {volume}, slippage {slippage}");
PrintLog($"Closed order result: {result}, ticketId = {orderId}, volume - {volume}, slippage {slippage}");
}
foreach (var orderId in sendedOrders)
@@ -312,7 +319,7 @@ namespace TestApiClientUI
var result = _apiClient.OrderCloseBy(ticket, opposite, color);
AddToLog($"ClosedBy order result: {result}, ticketId = {ticket}, opposite {opposite}");
PrintLog($"ClosedBy order result: {result}, ticketId = {ticket}, opposite {opposite}");
}
}
@@ -320,26 +327,26 @@ namespace TestApiClientUI
{
var result = _apiClient.OrderClosePrice();
textBoxOrderPrice.Text = result.ToString(CultureInfo.CurrentCulture);
AddToLog($"OrderClosePrice result: {result}");
PrintLog($"OrderClosePrice result: {result}");
}
private void OrderCloseTime()
{
var result = _apiClient.OrderCloseTime();
AddToLog($"OrderCloseTime result: {result}");
PrintLog($"OrderCloseTime result: {result}");
}
private void OrderComment()
{
var result = _apiClient.OrderComment();
textBoxOrderComment.Text = result;
AddToLog($"OrderComment result: {result}");
PrintLog($"OrderComment result: {result}");
}
private void OrderCommission()
{
var result = _apiClient.OrderCommission();
AddToLog($"OrderCommission result: {result}");
PrintLog($"OrderCommission result: {result}");
}
private void OrderDelete()
@@ -348,26 +355,26 @@ namespace TestApiClientUI
{
var ticket = (int)listBoxSendedOrders.SelectedItems[0];
var result = _apiClient.OrderDelete(ticket);
AddToLog($"Delete order result: {result}, ticketId = {ticket}");
PrintLog($"Delete order result: {result}, ticketId = {ticket}");
}
}
private void OrderExpiration()
{
var result = _apiClient.OrderExpiration();
AddToLog($"Expiration order result: {result}");
PrintLog($"Expiration order result: {result}");
}
private void OrderLots()
{
var result = _apiClient.OrderLots();
AddToLog($"Lots order result: {result}");
PrintLog($"Lots order result: {result}");
}
private void OrderMagicNumber()
{
var result = _apiClient.OrderMagicNumber();
AddToLog($"MagicNumber order result: {result}");
PrintLog($"MagicNumber order result: {result}");
}
private void OrderModify()
@@ -405,20 +412,20 @@ namespace TestApiClientUI
var result = _apiClient.OrderModify(ticket, price, stoploss, takeprofit, expiration, arrowColor);
AddToLog($"OrderModify result: {result}");
PrintLog($"OrderModify result: {result}");
}
}
private void OrderOpenPrice()
{
var result = _apiClient.OrderOpenPrice();
AddToLog($"OrderOpenPrice result: {result}");
PrintLog($"OrderOpenPrice result: {result}");
}
private void OrderOpenTime()
{
var result = _apiClient.OrderOpenTime();
AddToLog($"OpenTime order result: {result}");
PrintLog($"OpenTime order result: {result}");
}
private void OrderPrint()
@@ -429,7 +436,7 @@ namespace TestApiClientUI
private void OrderProfit()
{
var result = _apiClient.OrderProfit();
AddToLog($"Profit order result: {result}");
PrintLog($"Profit order result: {result}");
}
private void OrderSelect()
@@ -447,60 +454,60 @@ namespace TestApiClientUI
{
var result = _apiClient.OrderSelect(ticket, OrderSelectMode.SELECT_BY_POS);
AddToLog($"OrderSelect result: {result}");
PrintLog($"OrderSelect result: {result}");
}
}
private void OrdersHistoryTotal()
{
var result = _apiClient.OrdersHistoryTotal();
AddToLog($"OrdersHistoryTotal result: {result}");
PrintLog($"OrdersHistoryTotal result: {result}");
}
private void OrderStopLoss()
{
var result = _apiClient.OrderStopLoss();
textBoxOrderStoploss.Text = result.ToString(CultureInfo.CurrentCulture);
AddToLog($"OrderStopLoss result: {result}");
PrintLog($"OrderStopLoss result: {result}");
}
private void OrdersTotal()
{
var result = _apiClient.OrdersTotal();
AddToLog($"OrdersTotal result: {result}");
PrintLog($"OrdersTotal result: {result}");
}
private void OrderSwap()
{
var result = _apiClient.OrderSwap();
AddToLog($"OrderSwap result: {result}");
PrintLog($"OrderSwap result: {result}");
}
private void OrderSymbol()
{
var result = _apiClient.OrderSymbol();
textBoxOrderSymbol.Text = result;
AddToLog($"OrderSymbol result: {result}");
PrintLog($"OrderSymbol result: {result}");
}
private void OrderTakeProfit()
{
var result = _apiClient.OrderTakeProfit();
textBoxOrderProffit.Text = result.ToString(CultureInfo.CurrentCulture);
AddToLog($"OrderTakeProfit result: {result}");
PrintLog($"OrderTakeProfit result: {result}");
}
private void OrderTicket()
{
var result = _apiClient.OrderTicket();
AddToLog($"OrderTicket result: {result}");
PrintLog($"OrderTicket result: {result}");
}
private void OrderType()
{
var result = _apiClient.OrderType();
comboBoxOrderCommand.SelectedIndex = (int)result;
AddToLog($"OrderType result: {result}");
PrintLog($"OrderType result: {result}");
}
private void button2_Click(object sender, EventArgs e)
@@ -508,7 +515,7 @@ namespace TestApiClientUI
_groupOrderCommands[comboBoxSelectedCommand.SelectedIndex]();
}
private void AddToLog(string msg)
private void PrintLog(string msg)
{
RunOnUiThread(() =>
{
@@ -526,79 +533,79 @@ namespace TestApiClientUI
case 0:
{
var result = _apiClient.GetLastError();
AddToLog($"GetLastError result: {result}");
PrintLog($"GetLastError result: {result}");
}
break;
case 1:
{
var result = _apiClient.IsConnected();
AddToLog($"IsConnected result: {result}");
PrintLog($"IsConnected result: {result}");
}
break;
case 2:
{
var result = _apiClient.IsDemo();
AddToLog($"IsDemo result: {result}");
PrintLog($"IsDemo result: {result}");
}
break;
case 3:
{
var result = _apiClient.IsDllsAllowed();
AddToLog($"IsDllsAllowed result: {result}");
PrintLog($"IsDllsAllowed result: {result}");
}
break;
case 4:
{
var result = _apiClient.IsExpertEnabled();
AddToLog($"IsExpertEnabled result: {result}");
PrintLog($"IsExpertEnabled result: {result}");
}
break;
case 5:
{
var result = _apiClient.IsLibrariesAllowed();
AddToLog($"IsLibrariesAllowed result: {result}");
PrintLog($"IsLibrariesAllowed result: {result}");
}
break;
case 6:
{
var result = _apiClient.IsOptimization();
AddToLog($"IsOptimization result: {result}");
PrintLog($"IsOptimization result: {result}");
}
break;
case 7:
{
var result = _apiClient.IsStopped();
AddToLog($"IsStopped result: {result}");
PrintLog($"IsStopped result: {result}");
}
break;
case 8:
{
var result = _apiClient.IsTesting();
AddToLog($"IsTesting result: {result}");
PrintLog($"IsTesting result: {result}");
}
break;
case 9:
{
var result = _apiClient.IsTradeAllowed();
AddToLog($"IsTradeAllowed result: {result}");
PrintLog($"IsTradeAllowed result: {result}");
}
break;
case 10:
{
var result = _apiClient.IsTradeContextBusy();
AddToLog($"IsTradeContextBusy result: {result}");
PrintLog($"IsTradeContextBusy result: {result}");
}
break;
case 11:
{
var result = _apiClient.IsVisualMode();
AddToLog($"IsVisualMode result: {result}");
PrintLog($"IsVisualMode result: {result}");
}
break;
case 12:
{
var result = _apiClient.UninitializeReason();
AddToLog($"UninitializeReason result: {result}");
PrintLog($"UninitializeReason result: {result}");
}
break;
case 13:
@@ -606,7 +613,7 @@ namespace TestApiClientUI
int errorCode;
int.TryParse(textBoxErrorCode.Text, out errorCode);
var result = _apiClient.ErrorDescription(errorCode);
AddToLog($"ErrorDescription result: {result}");
PrintLog($"ErrorDescription result: {result}");
}
break;
default:
@@ -621,97 +628,97 @@ namespace TestApiClientUI
case 0:
{
var result = _apiClient.AccountBalance();
AddToLog($"AccountBalance result: {result}");
PrintLog($"AccountBalance result: {result}");
}
break;
case 1:
{
var result = _apiClient.AccountCredit();
AddToLog($"AccountCredit result: {result}");
PrintLog($"AccountCredit result: {result}");
}
break;
case 2:
{
var result = _apiClient.AccountCompany();
AddToLog($"AccountCompany result: {result}");
PrintLog($"AccountCompany result: {result}");
}
break;
case 3:
{
var result = _apiClient.AccountCurrency();
AddToLog($"AccountCurrency result: {result}");
PrintLog($"AccountCurrency result: {result}");
}
break;
case 4:
{
var result = _apiClient.AccountEquity();
AddToLog($"AccountEquity result: {result}");
PrintLog($"AccountEquity result: {result}");
}
break;
case 5:
{
var result = _apiClient.AccountFreeMargin();
AddToLog($"AccountFreeMargin result: {result}");
PrintLog($"AccountFreeMargin result: {result}");
}
break;
case 6:
{
var result = _apiClient.AccountFreeMarginCheck(textBoxAccountInfoSymbol.Text, (TradeOperation)comboBoxAccountInfoCmd.SelectedIndex, int.Parse(textBoxAccountInfoVolume.Text));
AddToLog($"AccountFreeMarginCheck result: {result}");
PrintLog($"AccountFreeMarginCheck result: {result}");
}
break;
case 7:
{
var result = _apiClient.AccountFreeMarginMode();
AddToLog($"AccountFreeMarginMode result: {result}");
PrintLog($"AccountFreeMarginMode result: {result}");
}
break;
case 8:
{
var result = _apiClient.AccountLeverage();
AddToLog($"AccountLeverage result: {result}");
PrintLog($"AccountLeverage result: {result}");
}
break;
case 9:
{
var result = _apiClient.AccountMargin();
AddToLog($"AccountMargin result: {result}");
PrintLog($"AccountMargin result: {result}");
}
break;
case 10:
{
var result = _apiClient.AccountName();
AddToLog($"AccountName result: {result}");
PrintLog($"AccountName result: {result}");
}
break;
case 11:
{
var result = _apiClient.AccountNumber();
AddToLog($"AccountNumber result: {result}");
PrintLog($"AccountNumber result: {result}");
}
break;
case 12:
{
var result = _apiClient.AccountProfit();
AddToLog($"AccountProfit result: {result}");
PrintLog($"AccountProfit result: {result}");
}
break;
case 13:
{
var result = _apiClient.AccountServer();
AddToLog($"AccountServer result: {result}");
PrintLog($"AccountServer result: {result}");
}
break;
case 14:
{
var result = _apiClient.AccountStopoutLevel();
AddToLog($"AccountStopoutLevel result: {result}");
PrintLog($"AccountStopoutLevel result: {result}");
}
break;
case 15:
{
var result = _apiClient.AccountStopoutMode();
AddToLog($"AccountStopoutMode result: {result}");
PrintLog($"AccountStopoutMode result: {result}");
}
break;
default:
@@ -719,13 +726,15 @@ 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);
AddToLog($"MarketInfo result: {result}");
var result = await Execute(() => _apiClient.MarketInfo(symbol, propId));
PrintLog($"MarketInfo result: {result}");
}
private void button6_Click(object sender, EventArgs e)
@@ -803,19 +812,19 @@ namespace TestApiClientUI
private void button13_Click(object sender, EventArgs e)
{
var retVal = _apiClient.TimeCurrent();
AddToLog($"TimeCurrent result: {retVal}");
PrintLog($"TimeCurrent result: {retVal}");
}
private void button14_Click(object sender, EventArgs e)
{
var retVal = _apiClient.TimeLocal();
AddToLog($"TimeLocal result: {retVal}");
PrintLog($"TimeLocal result: {retVal}");
}
private void buttonRefreshRates_Click(object sender, EventArgs e)
{
var retVal = _apiClient.RefreshRates();
AddToLog($"RefreshRates result: {retVal}");
PrintLog($"RefreshRates result: {retVal}");
}
private void listBoxEventLog_MouseDoubleClick(object sender, MouseEventArgs e)
@@ -834,11 +843,11 @@ namespace TestApiClientUI
}
catch (MtConnectionException ex)
{
AddToLog("MtExecutionException: " + ex.Message);
PrintLog("MtExecutionException: " + ex.Message);
}
catch (MtExecutionException ex)
{
AddToLog("MtExecutionException: " + ex.Message + "; ErrorCode = " + ex.ErrorCode);
PrintLog("MtExecutionException: " + ex.Message + "; ErrorCode = " + ex.ErrorCode);
}
return result;
@@ -891,7 +900,7 @@ namespace TestApiClientUI
var ticket = await Execute(() => _apiClient.OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit, comment, magic, expiration, arrowColor));
AddToLog($"Sended order result: ticket = {ticket}");
PrintLog($"Sended order result: ticket = {ticket}");
}
//GetOrder
@@ -907,7 +916,7 @@ namespace TestApiClientUI
{
var result =
$"Order: Ticket = {order.Ticket}, Symbol = {order.Symbol}, Operation = {order.Operation}, OpenPrice = {order.OpenPrice}, ClosePrice = {order.ClosePrice}, Lots = {order.Lots}, Profit = {order.Profit}, Comment = {order.Comment}, Commission = {order.Commission}, MagicNumber = {order.MagicNumber}, OpenTime = {order.OpenTime}, CloseTime = {order.CloseTime}, Swap = {order.Swap}, Expiration = {order.Expiration}, TakeProfit = {order.TakeProfit}, StopLoss = {order.StopLoss}";
AddToLog(result);
PrintLog(result);
}
}
@@ -925,12 +934,12 @@ namespace TestApiClientUI
{
var result =
$"Order: Ticket = {order.Ticket}, Symbol = {order.Symbol}, Operation = {order.Operation}, OpenPrice = {order.OpenPrice}, ClosePrice = {order.ClosePrice}, Lots = {order.Lots}, Profit = {order.Profit}, Comment = {order.Comment}, Commission = {order.Commission}, MagicNumber = {order.MagicNumber}, OpenTime = {order.OpenTime}, CloseTime = {order.CloseTime}, Swap = {order.Swap}, Expiration = {order.Expiration}, TakeProfit = {order.TakeProfit}, StopLoss = {order.StopLoss}";
AddToLog(result);
PrintLog(result);
}
}
else
{
AddToLog("GetOrders: 0 orders");
PrintLog("GetOrders: 0 orders");
}
}
@@ -946,7 +955,7 @@ namespace TestApiClientUI
var ticket = await Execute(() => _apiClient.OrderSendBuy(symbol, volume, slippage));
AddToLog(
PrintLog(
$"Sended order result: ticketId = {ticket}, symbol = {symbol}, volume = {volume}, slippage = {slippage}");
}
@@ -962,7 +971,7 @@ namespace TestApiClientUI
var ticket = await Execute(() => _apiClient.OrderSendSell(symbol, volume, slippage));
AddToLog($"Sended order result: ticketId = {ticket}, symbol = {symbol}, volume = {volume}, slippage = {slippage}");
PrintLog($"Sended order result: ticketId = {ticket}, symbol = {symbol}, volume = {volume}, slippage = {slippage}");
}
//OrderClose
@@ -987,7 +996,7 @@ namespace TestApiClientUI
closed = await Execute(() => _apiClient.OrderClose(ticket, volume, price, slippage));
}
AddToLog($"Close order result: {closed}, ticket = {ticket}");
PrintLog($"Close order result: {closed}, ticket = {ticket}");
}
//OrderCloseBy
@@ -998,7 +1007,7 @@ namespace TestApiClientUI
var closed = await Execute(() => _apiClient.OrderCloseBy(ticket, opposite));
AddToLog($"Close order result: {closed}, ticket = {ticket}");
PrintLog($"Close order result: {closed}, ticket = {ticket}");
}
//OrderDelete
@@ -1008,7 +1017,7 @@ namespace TestApiClientUI
var deleted = await Execute(() => _apiClient.OrderDelete(ticket));
AddToLog($"Delete order result: {deleted}, ticket = {ticket}");
PrintLog($"Delete order result: {deleted}, ticket = {ticket}");
}
//OrderModify
@@ -1045,7 +1054,7 @@ namespace TestApiClientUI
var modified = await Execute(() => _apiClient.OrderModify(ticket, price, stoploss, takeprofit, expiration, color));
AddToLog($"Modify order result: {modified}, ticket = {ticket}");
PrintLog($"Modify order result: {modified}, ticket = {ticket}");
}
//iCustom (ZigZag)
@@ -1059,7 +1068,7 @@ namespace TestApiClientUI
const int shift = 0;
var retVal = await Execute(() => _apiClient.iCustom(symbol, (int)timeframe, name, parameters, mode, shift));
AddToLog($"ICustom result: {retVal}");
PrintLog($"ICustom result: {retVal}");
}
//iCustom (Parabolic)
@@ -1073,7 +1082,7 @@ namespace TestApiClientUI
const int shift = 1;
var retVal = await Execute(() => _apiClient.iCustom(symbol, (int)timeframe, name, parameters, mode, shift));
AddToLog($"ICustom result: {retVal}");
PrintLog($"ICustom result: {retVal}");
}
//CopyRates
@@ -1094,12 +1103,12 @@ namespace TestApiClientUI
{
var result =
$"Rate: Time = {r.Time}, Open = {r.Open}, High = {r.High}, Low = {r.Low}, Close = {r.Close}, TickVolume = {r.TickVolume}, Spread = {r.Spread}, RealVolume = {r.RealVolume}";
AddToLog(result);
PrintLog(result);
}
}
else
{
AddToLog("CopyRates: 0 rates");
PrintLog("CopyRates: 0 rates");
}
}
@@ -1121,12 +1130,12 @@ namespace TestApiClientUI
{
var result =
$"Rate: Time = {r.Time}, Open = {r.Open}, High = {r.High}, Low = {r.Low}, Close = {r.Close}, TickVolume = {r.TickVolume}, Spread = {r.Spread}, RealVolume = {r.RealVolume}";
AddToLog(result);
PrintLog(result);
}
}
else
{
AddToLog("CopyRates: 0 rates");
PrintLog("CopyRates: 0 rates");
}
}
@@ -1148,12 +1157,12 @@ namespace TestApiClientUI
{
var result =
$"Rate: Time = {r.Time}, Open = {r.Open}, High = {r.High}, Low = {r.Low}, Close = {r.Close}, TickVolume = {r.TickVolume}, Spread = {r.Spread}, RealVolume = {r.RealVolume}";
AddToLog(result);
PrintLog(result);
}
}
else
{
AddToLog("CopyRates: 0 rates");
PrintLog("CopyRates: 0 rates");
}
}
@@ -1164,7 +1173,7 @@ namespace TestApiClientUI
if (!string.IsNullOrEmpty(msg))
{
_apiClient.Print(msg);
AddToLog("Print executed");
PrintLog("Print executed");
}
}
@@ -1172,10 +1181,10 @@ namespace TestApiClientUI
private async void button28_Click(object sender, EventArgs e)
{
var resultTrue = await Execute(() => _apiClient.SymbolsTotal(true));
AddToLog($"SymbolsTotal [true]: result = {resultTrue}");
PrintLog($"SymbolsTotal [true]: result = {resultTrue}");
var resultFalse = await Execute(() => _apiClient.SymbolsTotal(false));
AddToLog($"SymbolsTotal [false]: result = {resultFalse}");
PrintLog($"SymbolsTotal [false]: result = {resultFalse}");
}
//SymbolName
@@ -1185,7 +1194,7 @@ namespace TestApiClientUI
const bool selected = false;
var result = await Execute(() => _apiClient.SymbolName(pos, selected));
AddToLog($"SymbolName [true]: result = {result}");
PrintLog($"SymbolName [true]: result = {result}");
}
//SymbolSelect
@@ -1195,7 +1204,7 @@ namespace TestApiClientUI
const bool @select = true;
var result = await Execute(() => _apiClient.SymbolSelect(symbol, select));
AddToLog($"SymbolSelect [true]: result = {result}");
PrintLog($"SymbolSelect [true]: result = {result}");
}
//SymbolInfoInteger
@@ -1206,20 +1215,76 @@ namespace TestApiClientUI
Enum.TryParse(comboBox4.Text, out propId);
var result = await Execute(() => _apiClient.SymbolInfoInteger(symbol, propId));
AddToLog($"SymbolInfoInteger [true]: result = {result}");
PrintLog($"SymbolInfoInteger [true]: result = {result}");
}
private void _tradeMonitor_AvailabilityOrdersChanged(object sender, AvailabilityOrdersEventArgs e)
{
if (e.Opened != null)
{
AddToLog($"{sender.GetType()}: Opened orders - {string.Join(", ", e.Opened.Select(o => o.Ticket).ToList())}");
PrintLog($"{sender.GetType()}: Opened orders - {string.Join(", ", e.Opened.Select(o => o.Ticket).ToList())}");
}
if (e.Closed != null)
{
AddToLog($"{sender.GetType()}: Closed orders - {string.Join(", ", e.Closed.Select(o => o.Ticket).ToList())}");
PrintLog($"{sender.GetType()}: Closed orders - {string.Join(", ", e.Closed.Select(o => o.Ticket).ToList())}");
}
}
//SeriesInfoInteger
private async void button31_Click(object sender, EventArgs e)
{
var symbol = txtMarketInfoSymbol.Text;
ENUM_TIMEFRAMES timeframes;
Enum.TryParse(comboBox6.Text, out timeframes);
EnumSeriesInfoInteger propId;
Enum.TryParse(comboBox5.Text, out propId);
var result = await Execute(() => _apiClient.SeriesInfoInteger(symbol, timeframes, propId));
PrintLog($"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));
PrintLog($"SymbolInfoDouble: result = {result}");
}
//SymbolInfoTick
private async void button34_Click(object sender, EventArgs e)
{
var symbol = txtMarketInfoSymbol.Text;
var result = await Execute(() => _apiClient.SymbolInfoTick(symbol));
if (result != null)
{
PrintLog($"SymbolInfoTick: Tick - time = {result.Time}, Bid = {result.Bid}, Ask = {result.Ask}, Last = {result.Last}, Volume = {result.Volume}");
}
}
//TerminalInfoInteger
private async void button35_Click(object sender, EventArgs e)
{
EnumTerminalInfoInteger propId;
Enum.TryParse(comboBox9.Text, out propId);
var result = await Execute(() => _apiClient.TerminalInfoInteger(propId));
PrintLog($"TerminalInfoInteger: result = {result}");
}
//TerminalInfoDouble
private async void button36_Click(object sender, EventArgs e)
{
EnumTerminalInfoDouble propId;
Enum.TryParse(comboBox10.Text, out propId);
var result = await Execute(() => _apiClient.TerminalInfoDouble(propId));
PrintLog($"TerminalInfoDouble: result = {result}");
}
}
}
View File
Executable
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.