diff --git a/MTApiService/MTApiService.csproj b/MTApiService/MTApiService.csproj
index 64c83838..b99a1f50 100755
--- a/MTApiService/MTApiService.csproj
+++ b/MTApiService/MTApiService.csproj
@@ -44,14 +44,15 @@
MtApiKey.snk
-
- ..\packages\log4net.2.0.5\lib\net40-full\log4net.dll
- True
+
+ ..\packages\log4net.2.0.12\lib\net40\log4net.dll
+
+
diff --git a/MTApiService/packages.config b/MTApiService/packages.config
index d67e57f9..0066004f 100644
--- a/MTApiService/packages.config
+++ b/MTApiService/packages.config
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/MetaTraderApi_2017.sln b/MetaTraderApi_2017.sln
index d8351e85..4010dd14 100644
--- a/MetaTraderApi_2017.sln
+++ b/MetaTraderApi_2017.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30413.136
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApiClientUI", "TestClients\TestApiClientUI\TestApiClientUI.csproj", "{663CC515-EAAE-47D4-8933-5008C2DA1160}"
EndProject
@@ -47,6 +47,8 @@ Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "MtApiBootstrapper", "MtApiB
{78B94552-DB17-40EC-B7C6-23D32DB85DC1} = {78B94552-DB17-40EC-B7C6-23D32DB85DC1}
EndProjectSection
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MtApiServiceNetCore", "MtApiServiceNetCore\MtApiServiceNetCore.csproj", "{7CAFAAE2-0C15-479A-B16D-C2FCE0A48E11}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -232,6 +234,22 @@ Global
{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
+ {7CAFAAE2-0C15-479A-B16D-C2FCE0A48E11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7CAFAAE2-0C15-479A-B16D-C2FCE0A48E11}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7CAFAAE2-0C15-479A-B16D-C2FCE0A48E11}.Debug|Win32.ActiveCfg = Debug|Any CPU
+ {7CAFAAE2-0C15-479A-B16D-C2FCE0A48E11}.Debug|Win32.Build.0 = Debug|Any CPU
+ {7CAFAAE2-0C15-479A-B16D-C2FCE0A48E11}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {7CAFAAE2-0C15-479A-B16D-C2FCE0A48E11}.Debug|x64.Build.0 = Debug|Any CPU
+ {7CAFAAE2-0C15-479A-B16D-C2FCE0A48E11}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {7CAFAAE2-0C15-479A-B16D-C2FCE0A48E11}.Debug|x86.Build.0 = Debug|Any CPU
+ {7CAFAAE2-0C15-479A-B16D-C2FCE0A48E11}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7CAFAAE2-0C15-479A-B16D-C2FCE0A48E11}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7CAFAAE2-0C15-479A-B16D-C2FCE0A48E11}.Release|Win32.ActiveCfg = Release|Any CPU
+ {7CAFAAE2-0C15-479A-B16D-C2FCE0A48E11}.Release|Win32.Build.0 = Release|Any CPU
+ {7CAFAAE2-0C15-479A-B16D-C2FCE0A48E11}.Release|x64.ActiveCfg = Release|Any CPU
+ {7CAFAAE2-0C15-479A-B16D-C2FCE0A48E11}.Release|x64.Build.0 = Release|Any CPU
+ {7CAFAAE2-0C15-479A-B16D-C2FCE0A48E11}.Release|x86.ActiveCfg = Release|Any CPU
+ {7CAFAAE2-0C15-479A-B16D-C2FCE0A48E11}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -241,4 +259,7 @@ Global
{38B9C657-BC2F-44F0-8824-54B31F2A64F5} = {B91FF338-E05D-4EF1-948B-A2376DB37ECA}
{EB7C228D-9494-4985-845E-B8312450DF3D} = {B91FF338-E05D-4EF1-948B-A2376DB37ECA}
EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {23C8878C-16A5-47DF-9A57-73CCF847780D}
+ EndGlobalSection
EndGlobal
diff --git a/MtApi5/IMqlRates.cs b/MtApi5/IMqlRates.cs
new file mode 100644
index 00000000..c9f1e94c
--- /dev/null
+++ b/MtApi5/IMqlRates.cs
@@ -0,0 +1,18 @@
+// ReSharper disable InconsistentNaming
+using System;
+
+namespace MtApi5
+{
+ public interface IMqlRates
+ {
+ double close { get; set; }
+ double high { get; set; }
+ double low { get; set; }
+ long mt_time { get; set; }
+ double open { get; set; }
+ long real_volume { get; set; }
+ int spread { get; set; }
+ long tick_volume { get; set; }
+ DateTime time { get; }
+ }
+}
\ No newline at end of file
diff --git a/MtApi5/IMqlTradeRequest.cs b/MtApi5/IMqlTradeRequest.cs
new file mode 100644
index 00000000..237d1895
--- /dev/null
+++ b/MtApi5/IMqlTradeRequest.cs
@@ -0,0 +1,27 @@
+// ReSharper disable InconsistentNaming
+using System;
+
+namespace MtApi5
+{
+ public interface IMqlTradeRequest
+ {
+ ENUM_TRADE_REQUEST_ACTIONS Action { get; set; }
+ string Comment { get; set; }
+ ulong Deviation { get; set; }
+ DateTime Expiration { get; set; }
+ ulong Magic { get; set; }
+ int MtExpiration { get; }
+ ulong Order { get; set; }
+ ulong Position { get; set; }
+ ulong PositionBy { get; set; }
+ double Price { get; set; }
+ double Sl { get; set; }
+ double Stoplimit { get; set; }
+ string Symbol { get; set; }
+ double Tp { get; set; }
+ ENUM_ORDER_TYPE Type { get; set; }
+ ENUM_ORDER_TYPE_FILLING Type_filling { get; set; }
+ ENUM_ORDER_TYPE_TIME Type_time { get; set; }
+ double Volume { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/MtApi5/IMqlTradeResult.cs b/MtApi5/IMqlTradeResult.cs
new file mode 100644
index 00000000..c334019a
--- /dev/null
+++ b/MtApi5/IMqlTradeResult.cs
@@ -0,0 +1,17 @@
+// ReSharper disable InconsistentNaming
+
+namespace MtApi5
+{
+ public interface IMqlTradeResult
+ {
+ double Ask { get; }
+ double Bid { get; }
+ string Comment { get; }
+ ulong Deal { get; }
+ ulong Order { get; }
+ double Price { get; }
+ uint Request_id { get; }
+ uint Retcode { get; }
+ double Volume { get; }
+ }
+}
\ No newline at end of file
diff --git a/MtApi5/IMqlTradeTransaction.cs b/MtApi5/IMqlTradeTransaction.cs
new file mode 100644
index 00000000..30aadbea
--- /dev/null
+++ b/MtApi5/IMqlTradeTransaction.cs
@@ -0,0 +1,25 @@
+using System;
+
+namespace MtApi5
+{
+ public interface IMqlTradeTransaction
+ {
+ ulong Deal { get; set; }
+ ENUM_DEAL_TYPE DealType { get; set; }
+ int MtTimeExpiration { get; }
+ ulong Order { get; set; }
+ ENUM_ORDER_STATE OrderState { get; set; }
+ ENUM_ORDER_TYPE OrderType { get; set; }
+ ulong Position { get; set; }
+ ulong PositionBy { get; set; }
+ double Price { get; set; }
+ double PriceSl { get; set; }
+ double PriceTp { get; set; }
+ double PriceTrigger { get; set; }
+ string Symbol { get; set; }
+ DateTime TimeExpiration { get; set; }
+ ENUM_ORDER_TYPE_TIME TimeType { get; set; }
+ ENUM_TRADE_TRANSACTION_TYPE Type { get; set; }
+ double Volume { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/MtApi5/IMt5Quote.cs b/MtApi5/IMt5Quote.cs
new file mode 100644
index 00000000..0e542da0
--- /dev/null
+++ b/MtApi5/IMt5Quote.cs
@@ -0,0 +1,15 @@
+using System;
+
+namespace MtApi5
+{
+ public interface IMt5Quote
+ {
+ double Ask { get; }
+ double Bid { get; }
+ int ExpertHandle { get; set; }
+ string Instrument { get; }
+ double Last { get; set; }
+ DateTime Time { get; set; }
+ ulong Volume { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/MtApi5/IMtApi5Client.cs b/MtApi5/IMtApi5Client.cs
new file mode 100644
index 00000000..cd0e5293
--- /dev/null
+++ b/MtApi5/IMtApi5Client.cs
@@ -0,0 +1,243 @@
+// ReSharper disable InconsistentNaming
+using System;
+using System.Collections.Generic;
+
+namespace MtApi5
+{
+ public interface IMtApi5Client
+ {
+ Mt5ConnectionState ConnectionState { get; }
+ int ExecutorHandle { get; set; }
+
+ event EventHandler ConnectionStateChanged;
+ event EventHandler OnBookEvent;
+ event EventHandler OnLastTimeBar;
+ event EventHandler OnLockTicks;
+ event EventHandler OnTradeTransaction;
+ event EventHandler QuoteAdded;
+ event EventHandler QuoteRemoved;
+ event EventHandler QuoteUpdate;
+ event MtApi5Client.QuoteHandler QuoteUpdated;
+
+ double AccountInfoDouble(ENUM_ACCOUNT_INFO_DOUBLE propertyId);
+ long AccountInfoInteger(ENUM_ACCOUNT_INFO_INTEGER propertyId);
+ string AccountInfoString(ENUM_ACCOUNT_INFO_STRING propertyId);
+ void Alert(string message);
+ int Bars(string symbolName, ENUM_TIMEFRAMES timeframe);
+ int Bars(string symbolName, ENUM_TIMEFRAMES timeframe, DateTime startTime, DateTime stopTime);
+ int BarsCalculated(int indicatorHandle);
+ void BeginConnect(int port);
+ void BeginConnect(string host, int port);
+ void BeginDisconnect();
+ bool Buy(out MqlTradeResult result, double volume, string symbol = null, double price = 0, double sl = 0, double tp = 0, string comment = null);
+ bool ChartApplyTemplate(long chartId, string filename);
+ bool ChartClose(long chartId = 0);
+ long ChartFirst();
+ double ChartGetDouble(long chartId, ENUM_CHART_PROPERTY_DOUBLE propId, int subWindow = 0);
+ long ChartGetInteger(long chartId, ENUM_CHART_PROPERTY_INTEGER propId, int subWindow = 0);
+ string ChartGetString(long chartId, ENUM_CHART_PROPERTY_STRING propId);
+ long ChartId();
+ long ChartId(int expertHandle);
+ bool ChartIndicatorAdd(long chartId, int subWindow, int indicatorHandle);
+ bool ChartIndicatorDelete(long chartId, int subWindow, string indicatorShortname);
+ int ChartIndicatorGet(long chartId, int subWindow, string indicatorShortname);
+ string ChartIndicatorName(long chartId, int subWindow, int index);
+ int ChartIndicatorsTotal(long chartId, int subWindow);
+ bool ChartNavigate(long chartId, ENUM_CHART_POSITION position, int shift = 0);
+ long ChartNext(long chartId);
+ long ChartOpen(string symbol, ENUM_TIMEFRAMES period);
+ ENUM_TIMEFRAMES ChartPeriod(long chartId);
+ double ChartPriceOnDropped();
+ void ChartRedraw(long chartId = 0);
+ bool ChartSaveTemplate(long chartId, string filename);
+ bool ChartScreenShot(long chartId, string filename, int width, int height, ENUM_ALIGN_MODE alignMode = ENUM_ALIGN_MODE.ALIGN_RIGHT);
+ bool ChartSetDouble(long chartId, ENUM_CHART_PROPERTY_DOUBLE propId, double value);
+ bool ChartSetInteger(long chartId, ENUM_CHART_PROPERTY_INTEGER propId, long value);
+ bool ChartSetString(long chartId, ENUM_CHART_PROPERTY_STRING propId, string value);
+ bool ChartSetSymbolPeriod(long chartId, string symbol, ENUM_TIMEFRAMES period);
+ string ChartSymbol(long chartId);
+ DateTime ChartTimeOnDropped();
+ bool ChartTimePriceToXY(long chartId, int subWindow, DateTime? time, double price, out int x, out int y);
+ int ChartWindowFind(long chartId, string indicatorShortname);
+ int ChartWindowOnDropped();
+ int ChartXOnDropped();
+ bool ChartXYToTimePrice(long chartId, int x, int y, out int subWindow, out DateTime? time, out double price);
+ int ChartYOnDropped();
+ int CopyBuffer(int indicatorHandle, int bufferNum, DateTime startTime, DateTime stopTime, out double[] buffer);
+ int CopyBuffer(int indicatorHandle, int bufferNum, DateTime startTime, int count, out double[] buffer);
+ int CopyBuffer(int indicatorHandle, int bufferNum, int startPos, int count, out double[] buffer);
+ int CopyClose(string symbolName, ENUM_TIMEFRAMES timeframe, DateTime startTime, DateTime stopTime, out double[] closeArray);
+ int CopyClose(string symbolName, ENUM_TIMEFRAMES timeframe, DateTime startTime, int count, out double[] closeArray);
+ int CopyClose(string symbolName, ENUM_TIMEFRAMES timeframe, int startPos, int count, out double[] closeArray);
+ int CopyHigh(string symbolName, ENUM_TIMEFRAMES timeframe, DateTime startTime, DateTime stopTime, out double[] highArray);
+ int CopyHigh(string symbolName, ENUM_TIMEFRAMES timeframe, DateTime startTime, int count, out double[] highArray);
+ int CopyHigh(string symbolName, ENUM_TIMEFRAMES timeframe, int startPos, int count, out double[] highArray);
+ int CopyLow(string symbolName, ENUM_TIMEFRAMES timeframe, DateTime startTime, DateTime stopTime, out double[] lowArray);
+ int CopyLow(string symbolName, ENUM_TIMEFRAMES timeframe, DateTime startTime, int count, out double[] lowArray);
+ int CopyLow(string symbolName, ENUM_TIMEFRAMES timeframe, int startPos, int count, out double[] lowArray);
+ int CopyOpen(string symbolName, ENUM_TIMEFRAMES timeframe, DateTime startTime, DateTime stopTime, out double[] openArray);
+ int CopyOpen(string symbolName, ENUM_TIMEFRAMES timeframe, DateTime startTime, int count, out double[] openArray);
+ int CopyOpen(string symbolName, ENUM_TIMEFRAMES timeframe, int startPos, int count, out double[] openArray);
+ int CopyRates(string symbolName, ENUM_TIMEFRAMES timeframe, DateTime startTime, DateTime stopTime, out MqlRates[] ratesArray);
+ int CopyRates(string symbolName, ENUM_TIMEFRAMES timeframe, DateTime startTime, int count, out MqlRates[] ratesArray);
+ int CopyRates(string symbolName, ENUM_TIMEFRAMES timeframe, int startPos, int count, out MqlRates[] ratesArray);
+ int CopyRealVolume(string symbolName, ENUM_TIMEFRAMES timeframe, DateTime startTime, DateTime stopTime, out long[] volumeArray);
+ int CopyRealVolume(string symbolName, ENUM_TIMEFRAMES timeframe, DateTime startTime, int count, out long[] volumeArray);
+ int CopyRealVolume(string symbolName, ENUM_TIMEFRAMES timeframe, int startPos, int count, out long[] volumeArray);
+ int CopySpread(string symbolName, ENUM_TIMEFRAMES timeframe, DateTime startTime, DateTime stopTime, out int[] spreadArray);
+ int CopySpread(string symbolName, ENUM_TIMEFRAMES timeframe, DateTime startTime, int count, out int[] spreadArray);
+ int CopySpread(string symbolName, ENUM_TIMEFRAMES timeframe, int startPos, int count, out int[] spreadArray);
+ List CopyTicks(string symbolName, CopyTicksFlag flags = CopyTicksFlag.All, ulong from = 0, uint count = 0);
+ int CopyTickVolume(string symbolName, ENUM_TIMEFRAMES timeframe, DateTime startTime, DateTime stopTime, out long[] volumeArray);
+ int CopyTickVolume(string symbolName, ENUM_TIMEFRAMES timeframe, DateTime startTime, int count, out long[] volumeArray);
+ int CopyTickVolume(string symbolName, ENUM_TIMEFRAMES timeframe, int startPos, int count, out long[] volumeArray);
+ int CopyTime(string symbolName, ENUM_TIMEFRAMES timeframe, DateTime startTime, DateTime stopTime, out DateTime[] timeArray);
+ int CopyTime(string symbolName, ENUM_TIMEFRAMES timeframe, DateTime startTime, int count, out DateTime[] timeArray);
+ int CopyTime(string symbolName, ENUM_TIMEFRAMES timeframe, int startPos, int count, out DateTime[] timeArray);
+ int GetLastError();
+ IEnumerable GetQuotes();
+ bool GlobalVariableCheck(string name);
+ bool GlobalVariableDel(string name);
+ double GlobalVariableGet(string name);
+ string GlobalVariableName(int index);
+ int GlobalVariablesDeleteAll(string prefixName = "", DateTime? limitData = null);
+ DateTime GlobalVariableSet(string name, double value);
+ bool GlobalVariableSetOnCondition(string name, double value, double checkValue);
+ void GlobalVariablesFlush();
+ int GlobalVariablesTotal();
+ bool GlobalVariableTemp(string name);
+ DateTime GlobalVariableTime(string name);
+ double HistoryDealGetDouble(ulong ticketNumber, ENUM_DEAL_PROPERTY_DOUBLE propertyId);
+ long HistoryDealGetInteger(ulong ticketNumber, ENUM_DEAL_PROPERTY_INTEGER propertyId);
+ string HistoryDealGetString(ulong ticketNumber, ENUM_DEAL_PROPERTY_STRING propertyId);
+ ulong HistoryDealGetTicket(int index);
+ bool HistoryDealSelect(ulong ticket);
+ int HistoryDealsTotal();
+ double HistoryOrderGetDouble(ulong ticketNumber, ENUM_ORDER_PROPERTY_DOUBLE propertyId);
+ long HistoryOrderGetInteger(ulong ticketNumber, ENUM_ORDER_PROPERTY_INTEGER propertyId);
+ string HistoryOrderGetString(ulong ticketNumber, ENUM_ORDER_PROPERTY_STRING propertyId);
+ ulong HistoryOrderGetTicket(int index);
+ bool HistoryOrderSelect(ulong ticket);
+ int HistoryOrdersTotal();
+ bool HistorySelect(DateTime fromDate, DateTime toDate);
+ bool HistorySelectByPosition(long positionId);
+ int iAC(string symbol, ENUM_TIMEFRAMES period);
+ int iAD(string symbol, ENUM_TIMEFRAMES period, ENUM_APPLIED_VOLUME appliedVolume);
+ int iADX(string symbol, ENUM_TIMEFRAMES period, int adxPeriod);
+ int iADXWilder(string symbol, ENUM_TIMEFRAMES period, int adxPeriod);
+ int iAlligator(string symbol, ENUM_TIMEFRAMES period, int jawPeriod, int jawShift, int teethPeriod, int teethShift, int lipsPeriod, int lipsShift, ENUM_MA_METHOD maMethod, ENUM_APPLIED_PRICE appliedPrice);
+ int iAMA(string symbol, ENUM_TIMEFRAMES period, int amaPeriod, int fastMaPeriod, int slowMaPeriod, int amaShift, ENUM_APPLIED_PRICE appliedPrice);
+ int iAO(string symbol, ENUM_TIMEFRAMES period);
+ int iATR(string symbol, ENUM_TIMEFRAMES period, int maPeriod);
+ int iBands(string symbol, ENUM_TIMEFRAMES period, int bandsPeriod, int bandsShift, double deviation, ENUM_APPLIED_PRICE appliedPrice);
+ int iBearsPower(string symbol, ENUM_TIMEFRAMES period, int maPeriod);
+ int iBullsPower(string symbol, ENUM_TIMEFRAMES period, int maPeriod);
+ int iBWMFI(string symbol, ENUM_TIMEFRAMES period, ENUM_APPLIED_VOLUME appliedVolume);
+ int iCCI(string symbol, ENUM_TIMEFRAMES period, int maPeriod, ENUM_APPLIED_PRICE appliedPrice);
+ int iChaikin(string symbol, ENUM_TIMEFRAMES period, int fastMaPeriod, int slowMaPeriod, ENUM_MA_METHOD maMethod, ENUM_APPLIED_VOLUME appliedVolume);
+ int iCustom(string symbol, ENUM_TIMEFRAMES period, string name, bool[] parameters);
+ int iCustom(string symbol, ENUM_TIMEFRAMES period, string name, double[] parameters);
+ int iCustom(string symbol, ENUM_TIMEFRAMES period, string name, int[] parameters);
+ int iCustom(string symbol, ENUM_TIMEFRAMES period, string name, string[] parameters);
+ int iDEMA(string symbol, ENUM_TIMEFRAMES period, int maPeriod, int maShift, ENUM_APPLIED_PRICE appliedPrice);
+ int iDeMarker(string symbol, ENUM_TIMEFRAMES period, int maPeriod);
+ int iEnvelopes(string symbol, ENUM_TIMEFRAMES period, int maPeriod, int maShift, ENUM_MA_METHOD maMethod, ENUM_APPLIED_PRICE appliedPrice, double deviation);
+ int iForce(string symbol, ENUM_TIMEFRAMES period);
+ int iForce(string symbol, ENUM_TIMEFRAMES period, int maPeriod, ENUM_MA_METHOD maMethod, ENUM_APPLIED_VOLUME appliedVolume);
+ int iFrAMA(string symbol, ENUM_TIMEFRAMES period, int maPeriod, int maShift, ENUM_APPLIED_PRICE appliedPrice);
+ int iGator(string symbol, ENUM_TIMEFRAMES period, int jawPeriod, int jawShift, int teethPeriod, int teethShift, int lipsPeriod, int lipsShift, ENUM_MA_METHOD maMethod, ENUM_APPLIED_PRICE appliedPrice);
+ int iIchimoku(string symbol, ENUM_TIMEFRAMES period, int tenkanSen, int kijunSen, int senkouSpanB);
+ int iMA(string symbol, ENUM_TIMEFRAMES period, int maPeriod, int maShift, ENUM_MA_METHOD maMethod, ENUM_APPLIED_PRICE appliedPrice);
+ int iMACD(string symbol, ENUM_TIMEFRAMES period, int fastEmaPeriod, int slowEmaPeriod, int signalPeriod, ENUM_APPLIED_PRICE appliedPrice);
+ int iMFI(string symbol, ENUM_TIMEFRAMES period, int maPeriod, ENUM_APPLIED_VOLUME appliedVolume);
+ int iMomentum(string symbol, ENUM_TIMEFRAMES period, int momPeriod, ENUM_APPLIED_PRICE appliedPrice);
+ int IndicatorCreate(string symbol, ENUM_TIMEFRAMES period, ENUM_INDICATOR indicatorType, List parameters = null);
+ bool IndicatorRelease(int indicatorHandle);
+ int iOBV(string symbol, ENUM_TIMEFRAMES period, ENUM_APPLIED_VOLUME appliedVolume);
+ int iOsMA(string symbol, ENUM_TIMEFRAMES period, int fastEmaPeriod, int slowEmaPeriod, int signalPeriod, ENUM_APPLIED_PRICE appliedPrice);
+ int iRSI(string symbol, ENUM_TIMEFRAMES period, int maPeriod, ENUM_APPLIED_PRICE appliedPrice);
+ int iRVI(string symbol, ENUM_TIMEFRAMES period, int maPeriod);
+ int iSAR(string symbol, ENUM_TIMEFRAMES period, double step, double maximum);
+ int iStdDev(string symbol, ENUM_TIMEFRAMES period, int maPeriod, int maShift, ENUM_MA_METHOD maMethod, ENUM_APPLIED_PRICE appliedPrice);
+ bool IsTesting();
+ int iStochastic(string symbol, ENUM_TIMEFRAMES period, int Kperiod, int Dperiod, int slowing, ENUM_MA_METHOD maMethod, ENUM_STO_PRICE priceField);
+ int iTEMA(string symbol, ENUM_TIMEFRAMES period, int maPeriod, int maShift, ENUM_APPLIED_PRICE appliedPrice);
+ int iTriX(string symbol, ENUM_TIMEFRAMES period, int maPeriod, ENUM_APPLIED_PRICE appliedPrice);
+ int iVIDyA(string symbol, ENUM_TIMEFRAMES period, int cmoPeriod, int emaPeriod, int maShift, ENUM_APPLIED_PRICE appliedPrice);
+ int iVolumes(string symbol, ENUM_TIMEFRAMES period, ENUM_APPLIED_VOLUME appliedVolume);
+ int iWPR(string symbol, ENUM_TIMEFRAMES period, int calcPeriod);
+ bool MarketBookAdd(string symbol);
+ bool MarketBookGet(string symbol, out MqlBookInfo[] book);
+ bool MarketBookRelease(string symbol);
+ bool ObjectCreate(long chartId, string name, ENUM_OBJECT type, int nwin, DateTime time, double price, List> listOfCoordinates = null);
+ bool ObjectDelete(long chartId, string name);
+ int ObjectFind(long chartId, string name);
+ double ObjectGetDouble(long chartId, string name, ENUM_OBJECT_PROPERTY_DOUBLE propId);
+ long ObjectGetInteger(long chartId, string name, ENUM_OBJECT_PROPERTY_INTEGER propId);
+ string ObjectGetString(long chartId, string name, ENUM_OBJECT_PROPERTY_STRING propId);
+ DateTime ObjectGetTimeByValue(long chartId, string name, double value, int lineId);
+ double ObjectGetValueByTime(long chartId, string name, DateTime time, int lineId);
+ bool ObjectMove(long chartId, string name, int pointIndex, DateTime time, double price);
+ string ObjectName(long chartId, int pos, int subWindow = -1, int type = -1);
+ int ObjectsDeleteAll(long chartId, int subWindow = -1, int type = -1);
+ bool ObjectSetDouble(long chartId, string name, ENUM_OBJECT_PROPERTY_DOUBLE propId, double propValue);
+ bool ObjectSetInteger(long chartId, string name, ENUM_OBJECT_PROPERTY_INTEGER propId, long propValue);
+ bool ObjectSetString(long chartId, string name, ENUM_OBJECT_PROPERTY_STRING propId, string propValue);
+ int ObjectsTotal(long chartId, int subWindow = -1, int type = -1);
+ bool OrderCalcMargin(ENUM_ORDER_TYPE action, string symbol, double volume, double price, out double margin);
+ bool OrderCalcProfit(ENUM_ORDER_TYPE action, string symbol, double volume, double priceOpen, double priceClose, out double profit);
+ bool OrderCheck(MqlTradeRequest request, out MqlTradeCheckResult result);
+ bool OrderCloseAll();
+ double OrderGetDouble(ENUM_ORDER_PROPERTY_DOUBLE propertyId);
+ long OrderGetInteger(ENUM_ORDER_PROPERTY_INTEGER propertyId);
+ string OrderGetString(ENUM_ORDER_PROPERTY_STRING propertyId);
+ ulong OrderGetTicket(int index);
+ bool OrderSelect(ulong ticket);
+ bool OrderSend(MqlTradeRequest request, out MqlTradeResult result);
+ bool OrderSendAsync(MqlTradeRequest request, out MqlTradeResult result);
+ int OrdersTotal();
+ bool PositionClose(ulong ticket, ulong deviation = ulong.MaxValue);
+ bool PositionClose(ulong ticket, out MqlTradeResult result);
+ bool PositionClose(ulong ticket, ulong deviation, out MqlTradeResult result);
+ int PositionCloseAll();
+ bool PositionClosePartial(string symbol, double volume, ulong deviation = ulong.MaxValue);
+ bool PositionClosePartial(ulong ticket, double volume, ulong deviation = ulong.MaxValue);
+ double PositionGetDouble(ENUM_POSITION_PROPERTY_DOUBLE propertyId);
+ long PositionGetInteger(ENUM_POSITION_PROPERTY_INTEGER propertyId);
+ string PositionGetString(ENUM_POSITION_PROPERTY_STRING propertyId);
+ string PositionGetSymbol(int index);
+ ulong PositionGetTicket(int index);
+ bool PositionModify(ulong ticket, double sl, double tp);
+ bool PositionOpen(string symbol, ENUM_ORDER_TYPE orderType, double volume, double price, double sl, double tp, string comment = "");
+ bool PositionOpen(string symbol, ENUM_ORDER_TYPE orderType, double volume, double price, double sl, double tp, out MqlTradeResult result);
+ bool PositionOpen(string symbol, ENUM_ORDER_TYPE orderType, double volume, double price, double sl, double tp, string comment, out MqlTradeResult result);
+ bool PositionSelect(string symbol);
+ bool PositionSelectByTicket(ulong ticket);
+ int PositionsTotal();
+ bool Print(string message);
+ void ResetLastError();
+ bool Sell(out MqlTradeResult result, double volume, string symbol = null, double price = 0, double sl = 0, double tp = 0, string comment = null);
+ long SeriesInfoInteger(string symbolName, ENUM_TIMEFRAMES timeframe, ENUM_SERIES_INFO_INTEGER propId);
+ double SymbolInfoDouble(string symbolName, ENUM_SYMBOL_INFO_DOUBLE propId);
+ long SymbolInfoInteger(string symbolName, ENUM_SYMBOL_INFO_INTEGER propId);
+ bool SymbolInfoSessionQuote(string name, ENUM_DAY_OF_WEEK dayOfWeek, uint sessionIndex, out DateTime from, out DateTime to);
+ bool SymbolInfoSessionTrade(string name, ENUM_DAY_OF_WEEK dayOfWeek, uint sessionIndex, out DateTime from, out DateTime to);
+ string SymbolInfoString(string symbolName, ENUM_SYMBOL_INFO_STRING propId);
+ bool SymbolInfoString(string symbolName, ENUM_SYMBOL_INFO_STRING propId, out string value);
+ MqlTick SymbolInfoTick(string symbol);
+ bool SymbolInfoTick(string symbol, out MqlTick tick);
+ bool SymbolIsSynchronized(string symbolName);
+ string SymbolName(int pos, bool selected);
+ bool SymbolSelect(string symbolName, bool selected);
+ int SymbolsTotal(bool selected);
+ double TerminalInfoDouble(ENUM_TERMINAL_INFO_DOUBLE propertyId);
+ int TerminalInfoInteger(ENUM_TERMINAL_INFO_INTEGER propertyId);
+ string TerminalInfoString(ENUM_TERMINAL_INFO_STRING propertyId);
+ void TesterStop();
+ DateTime TimeCurrent();
+ DateTime TimeGMT();
+ DateTime TimeLocal();
+ DateTime TimeTradeServer();
+ void UnlockTicks();
+ }
+}
\ No newline at end of file
diff --git a/MtApi5/MqlRates.cs b/MtApi5/MqlRates.cs
index 8d8ee6e6..1852588a 100755
--- a/MtApi5/MqlRates.cs
+++ b/MtApi5/MqlRates.cs
@@ -3,7 +3,7 @@
namespace MtApi5
{
- public class MqlRates
+ public class MqlRates : IMqlRates
{
public MqlRates(DateTime time, double open, double high, double low, double close, long tick_volume, int spread, long real_volume)
{
diff --git a/MtApi5/MqlTradeRequest.cs b/MtApi5/MqlTradeRequest.cs
index a3f3d118..4b2fc0fa 100755
--- a/MtApi5/MqlTradeRequest.cs
+++ b/MtApi5/MqlTradeRequest.cs
@@ -4,7 +4,7 @@
namespace MtApi5
{
- public class MqlTradeRequest
+ public class MqlTradeRequest : IMqlTradeRequest
{
public ENUM_TRADE_REQUEST_ACTIONS Action { get; set; } // Trade operation type
public ulong Magic { get; set; } // Expert Advisor ID (magic number)
@@ -24,7 +24,7 @@ public class MqlTradeRequest
public DateTime Expiration // Order expiration time (for the orders of ORDER_TIME_SPECIFIED type)
{
get { return Mt5TimeConverter.ConvertFromMtTime(MtExpiration); }
- set { MtExpiration = Mt5TimeConverter.ConvertToMtTime(value); }
+ set { MtExpiration = Mt5TimeConverter.ConvertToMtTime(value); }
}
public string Comment { get; set; } // Order comment
diff --git a/MtApi5/MqlTradeResult.cs b/MtApi5/MqlTradeResult.cs
index 8e091708..574d1155 100755
--- a/MtApi5/MqlTradeResult.cs
+++ b/MtApi5/MqlTradeResult.cs
@@ -2,7 +2,7 @@
namespace MtApi5
{
- public class MqlTradeResult
+ public class MqlTradeResult : IMqlTradeResult
{
public MqlTradeResult(uint retcode, ulong deal, ulong order, double volume, double price, double bid, double ask, string comment, uint request_id)
{
diff --git a/MtApi5/MqlTradeTransaction.cs b/MtApi5/MqlTradeTransaction.cs
index 656f12fa..f5961569 100644
--- a/MtApi5/MqlTradeTransaction.cs
+++ b/MtApi5/MqlTradeTransaction.cs
@@ -3,7 +3,7 @@
namespace MtApi5
{
- public class MqlTradeTransaction
+ public class MqlTradeTransaction : IMqlTradeTransaction
{
public ulong Deal { get; set; } // Deal ticket
public ulong Order { get; set; } // Order ticket
diff --git a/MtApi5/Mt5CommandType.cs b/MtApi5/Mt5CommandType.cs
index c50d5521..0a5691a6 100755
--- a/MtApi5/Mt5CommandType.cs
+++ b/MtApi5/Mt5CommandType.cs
@@ -255,6 +255,8 @@ internal enum Mt5CommandType
UnlockTicks = 159,
PositionCloseAll = 160,
- TesterStop = 161
+ TesterStop = 161,
+ TesterDeposit = 162,
+ TesterWithdrawal = 163
}
}
diff --git a/MtApi5/Mt5Quote.cs b/MtApi5/Mt5Quote.cs
index c3ec47c4..f7d14b3c 100755
--- a/MtApi5/Mt5Quote.cs
+++ b/MtApi5/Mt5Quote.cs
@@ -3,7 +3,7 @@
namespace MtApi5
{
- public class Mt5Quote
+ public class Mt5Quote : IMt5Quote
{
public string Instrument { get; }
public double Bid { get; }
@@ -12,8 +12,8 @@ public class Mt5Quote
public DateTime Time { get; set; }
public double Last { get; set; }
public ulong Volume { get; set; }
-// public long TimeMsc { get; set; }
-// public uint Flags { get; set; }
+ // public long TimeMsc { get; set; }
+ // public uint Flags { get; set; }
internal Mt5Quote(string instrument, double bid, double ask)
{
@@ -23,7 +23,7 @@ internal Mt5Quote(string instrument, double bid, double ask)
}
internal Mt5Quote(MtQuote quote)
- :this(quote.Instrument, quote.Bid, quote.Ask)
+ : this(quote.Instrument, quote.Bid, quote.Ask)
{
ExpertHandle = quote.ExpertHandle;
}
diff --git a/MtApi5/MtApi5.csproj b/MtApi5/MtApi5.csproj
old mode 100755
new mode 100644
index 8596a9c9..c0cffb60
--- a/MtApi5/MtApi5.csproj
+++ b/MtApi5/MtApi5.csproj
@@ -1,123 +1,25 @@
-
-
+
- Debug
- AnyCPU
- 8.0.30703
- 2.0
- {AC8B5010-DA75-477E-9CA5-547C649E12D8}
+ net5.0
Library
- Properties
- MtApi5
- MtApi5
- v4.0
- 512
+ false
- true
- full
- false
..\build\products\Debug\
- DEBUG;TRACE
- prompt
- 4
false
+ embedded
- pdbonly
- true
..\build\products\Release\
- TRACE
- prompt
- 4
+ embedded
-
- ..\packages\Newtonsoft.Json.12.0.2\lib\net40\Newtonsoft.Json.dll
- True
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
- {DE76D5C7-B99C-4467-8408-78173BDD84E0}
- MTApiService
-
+
-
-
-
-
-
\ No newline at end of file
diff --git a/MtApi5/MtApi5Client.cs b/MtApi5/MtApi5Client.cs
index a28348c0..0dbaec79 100755
--- a/MtApi5/MtApi5Client.cs
+++ b/MtApi5/MtApi5Client.cs
@@ -12,13 +12,13 @@
namespace MtApi5
{
- public class MtApi5Client
+ public class MtApi5Client : IMtApi5Client
{
#region MT Constants
- public const int SYMBOL_EXPIRATION_GTC = 1;
- public const int SYMBOL_EXPIRATION_DAY = 2;
- public const int SYMBOL_EXPIRATION_SPECIFIED = 4;
- public const int SYMBOL_EXPIRATION_SPECIFIED_DAY = 8;
+ public const int SYMBOL_EXPIRATION_GTC = 1;
+ public const int SYMBOL_EXPIRATION_DAY = 2;
+ public const int SYMBOL_EXPIRATION_SPECIFIED = 4;
+ public const int SYMBOL_EXPIRATION_SPECIFIED_DAY = 8;
public const int SYMBOL_FILLING_ALL_OR_NONE = 1;
public const int SYMBOL_CANCEL_REMAIND = 1;
@@ -42,7 +42,7 @@ public class MtApi5Client
private int _executorHandle;
private readonly Dictionary> _mtEventHandlers =
new Dictionary>();
-
+
#endregion
#region Public Methods
@@ -596,7 +596,7 @@ public bool PositionClose(ulong ticket, ulong deviation = ulong.MaxValue)
///
public bool PositionModify(ulong ticket, double sl, double tp)
{
- var commandParameters = new ArrayList { ticket, sl,tp };
+ var commandParameters = new ArrayList { ticket, sl, tp };
return SendCommand(Mt5CommandType.PositionModify, commandParameters);
}
@@ -644,7 +644,7 @@ public bool PositionClose(ulong ticket, out MqlTradeResult result)
/// true - successful check of the basic structures, otherwise - false.
public bool PositionOpen(string symbol, ENUM_ORDER_TYPE orderType, double volume, double price, double sl, double tp, string comment = "")
{
- var commandParameters = new ArrayList { symbol, (int) orderType, volume, price, sl, tp, comment };
+ var commandParameters = new ArrayList { symbol, (int)orderType, volume, price, sl, tp, comment };
return SendCommand(Mt5CommandType.PositionOpen, commandParameters);
}
@@ -936,7 +936,7 @@ public int CopyRates(string symbolName, ENUM_TIMEFRAMES timeframe, int startPos,
if (retVal != null)
{
ratesArray = new MqlRates[retVal.Length];
- for(var i = 0; i < retVal.Length; i++)
+ for (var i = 0; i < retVal.Length; i++)
{
ratesArray[i] = new MqlRates(retVal[i].time
, retVal[i].open
@@ -951,7 +951,7 @@ public int CopyRates(string symbolName, ENUM_TIMEFRAMES timeframe, int startPos,
return ratesArray?.Length ?? 0;
}
-
+
///
///Gets history data of MqlRates structure of a specified symbol-period in specified quantity into the ratesArray array. The elements ordering of the copied data is from present to the past, i.e., starting position of 0 means the current bar.
///
@@ -1614,7 +1614,7 @@ public bool SymbolInfoString(string symbolName, ENUM_SYMBOL_INFO_STRING propId,
///
///Symbol name.
/// Link to the structure of the MqlTick type, to which the current prices and time of the last price update will be placed.
- public bool SymbolInfoTick(string symbol, out MqlTick tick)
+ public bool SymbolInfoTick(string symbol, out MqlTick tick)
{
tick = SendRequest(new SymbolInfoTickRequest
{
@@ -1652,7 +1652,7 @@ public bool SymbolInfoSessionQuote(string name, ENUM_DAY_OF_WEEK dayOfWeek, uint
string strResult = SendCommand(Mt5CommandType.SymbolInfoSessionQuote, commandParameters);
- return strResult.ParseResult(ParamSeparator, out from, out to);
+ return strResult.ParseResult(ParamSeparator, out from, out to);
}
///
@@ -1804,12 +1804,12 @@ public int ChartWindowFind(long chartId, string indicatorShortname)
public bool ChartTimePriceToXY(long chartId, int subWindow, DateTime? time, double price, out int x, out int y)
{
var result = SendRequest(new ChartTimePriceToXyRequest
- {
- ChartId = chartId,
- SubWindow = subWindow,
- Time = time,
- Price = price
- });
+ {
+ ChartId = chartId,
+ SubWindow = subWindow,
+ Time = time,
+ Price = price
+ });
x = result?.X ?? 0;
y = result?.Y ?? 0;
@@ -2241,6 +2241,28 @@ public void TesterStop()
SendCommand