Compare commits

...

14 Commits

Author SHA1 Message Date
vdemydiuk 5c96aeb2fd Issue #81: Added function TimeGMT into MtApi (MT4) 2018-02-13 19:02:08 +02:00
vdemydiuk a238e5eb36 Issue #80: Fixed wrong condition on fetch first parameter in function Execute_TerminalInfoString 2018-02-13 18:35:40 +02:00
vdemydiuk 11fd5b7527 Started version 1.0.40 (MT4) 2018-02-13 18:33:11 +02:00
vdemydiuk cbe75cfbf6 Issue #83: Added command button HistoryDealMethods to check functions related to the issue 2018-02-08 18:04:15 +02:00
vdemydiuk 9581431a9f Issue #84: Fixed bug in function HistoryOrderGetInteger, there was wrong return value type 2018-02-04 14:39:09 +02:00
vdemydiuk acf0c12531 MT5: started version 1.0.15 2018-02-04 14:02:41 +02:00
DW 1eccda9b2c Version MtApi4 1.0.39 2018-01-16 16:11:33 +02:00
DW fd4aac7c32 Issie #73: added wrapped function getBooleanValueW into MtApi.mq4. Issue #76: added precompiled value __DEBUG_LOG__ into MtApi.mq4 to disable logging in release verion 2018-01-16 16:06:21 +02:00
DW 36c90c8481 Updated test application (MT5): added test functions HistoryDealGetDouble, HistoryDealGetInteger, HistoryDealGetString 2018-01-11 15:28:57 +02:00
DW fefa451371 Issue #39: Added indicator functions on MQL side (MtApi MT5) 2018-01-10 19:13:31 +02:00
DW 1c57f88cb1 Issue #72: Fixed bug with serialization of parameters in functions HistoryDealGetInteger, HistoryDealGetString, HistoryDealGetDouble 2017-11-27 18:16:35 +02:00
DW 08ba45c65f Issue #39: Added indicator functions on C# side (MtApi MT5) 2017-11-27 18:09:54 +02:00
DW b8314e9ed7 MtApi5: add waiting incoming connection on MT5 side in backtesting mode 2017-11-15 18:16:23 +02:00
DW 9587b10c8c MtApi5 version 1.0.14 2017-11-15 18:15:34 +02:00
19 changed files with 2861 additions and 99 deletions
+6
View File
@@ -994,6 +994,12 @@ namespace MtApi
return MtApiTimeConverter.ConvertFromMtTime(commandResponse);
}
public DateTime TimeGMT()
{
var commandResponse = SendCommand<int>(MtCommandType.TimeGMT, null);
return MtApiTimeConverter.ConvertFromMtTime(commandResponse);
}
public int TimeDay(DateTime date)
{
var commandParameters = new ArrayList { MtApiTimeConverter.ConvertToMtTime(date) };
+1
View File
@@ -111,6 +111,7 @@
TimeSeconds = 86,
TimeYear = 87,
Year = 88,
TimeGMT = 281,
//Global Variables
GlobalVariableCheck = 89,
+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.38.0")]
[assembly: AssemblyFileVersion("1.0.38.0")]
[assembly: AssemblyVersion("1.0.40.0")]
[assembly: AssemblyFileVersion("1.0.40.0")]
+41 -1
View File
@@ -130,6 +130,46 @@
ObjectSetString = 84,
//TextSetFont = 85,
//TextOut = 86,
//TextGetSize = 87
//TextGetSize = 87,
iAC = 88,
iAD = 89,
iADX = 90,
iADXWilder = 91,
iAlligator = 92,
iAMA = 93,
iAO = 94,
iATR = 95,
iBearsPower = 96,
iBands = 97,
iBullsPower = 98,
iCCI = 99,
iChaikin = 100,
//iCustom = 101,
iDEMA = 102,
iDeMarker = 103,
iEnvelopes = 104,
iForce = 105,
iFractals = 106,
iFrAMA = 107,
iGator = 108,
iIchimoku = 109,
iBWMFI = 110,
iMomentum = 111,
iMFI = 112,
iMA = 113,
iOsMA = 114,
iMACD = 115,
iOBV = 116,
iSAR = 117,
iRSI = 118,
iRVI = 119,
iStdDev = 120,
iStochastic = 121,
iTEMA = 122,
iTriX = 123,
iWPR = 124,
iVIDyA = 125,
iVolumes = 126
}
}
+41 -2
View File
@@ -742,5 +742,44 @@
ALIGN_CENTER = 2, // Centered (only for the Edit object)
ALIGN_RIGHT = 0, // Right alignment
}
#endregion
}
#endregion //Object Properties
#region Price Constants
public enum ENUM_APPLIED_PRICE
{
PRICE_CLOSE = 1, //Close price
PRICE_OPEN = 2, //Open price
PRICE_HIGH = 3, //The maximum price for the period
PRICE_LOW = 4, //The minimum price for the period
PRICE_MEDIAN = 5, //Median price, (high + low)/2
PRICE_TYPICAL = 6, //Typical price, (high + low + close)/3
PRICE_WEIGHTED = 7 //Average price, (high + low + close + close)/4
}
public enum ENUM_APPLIED_VOLUME
{
VOLUME_TICK = 0, //Tick volume
VOLUME_REAL = 1 //Trade volume
}
public enum ENUM_STO_PRICE
{
STO_LOWHIGH = 0, //Calculation is based on Low/High prices
STO_CLOSECLOSE = 1 //Calculation is based on Close/Close prices
}
#endregion //Price Constants
#region Smoothing Methods
public enum ENUM_MA_METHOD
{
MODE_SMA = 0, //Simple averaging
MODE_EMA = 1, //Exponential averaging
MODE_SMMA = 2, //Smoothed averaging
MODE_LWMA = 3 //Linear-weighted averaging
}
#endregion //Smoothing Methods
}
+2
View File
@@ -67,9 +67,11 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Mt5Quote.cs" />
<Compile Include="Requests\CopyTicksRequest.cs" />
<Compile Include="Requests\ICustomRequest.cs" />
<Compile Include="Requests\RequestBase.cs" />
<Compile Include="Requests\RequestType.cs" />
<Compile Include="Responses\CopyTicksResponse.cs" />
<Compile Include="Responses\ICustomResponse.cs" />
<Compile Include="Responses\ResponseBase.cs" />
</ItemGroup>
<ItemGroup>
+566 -5
View File
@@ -456,7 +456,7 @@ namespace MtApi5
///<param name="propertyId"> Identifier of a deal property.</param>
public double HistoryDealGetDouble(ulong ticketNumber, ENUM_DEAL_PROPERTY_DOUBLE propertyId)
{
var commandParameters = new ArrayList { ticketNumber, propertyId };
var commandParameters = new ArrayList { ticketNumber, (int)propertyId };
return SendCommand<double>(Mt5CommandType.HistoryDealGetDouble, commandParameters);
}
@@ -468,7 +468,7 @@ namespace MtApi5
///<param name="propertyId"> Identifier of a deal property.</param>
public long HistoryDealGetInteger(ulong ticketNumber, ENUM_DEAL_PROPERTY_INTEGER propertyId)
{
var commandParameters = new ArrayList { ticketNumber, propertyId };
var commandParameters = new ArrayList { ticketNumber, (int)propertyId };
return SendCommand<long>(Mt5CommandType.HistoryDealGetInteger, commandParameters);
}
@@ -480,7 +480,7 @@ namespace MtApi5
///<param name="propertyId"> Identifier of a deal property.</param>
public string HistoryDealGetString(ulong ticketNumber, ENUM_DEAL_PROPERTY_STRING propertyId)
{
var commandParameters = new ArrayList { ticketNumber, propertyId };
var commandParameters = new ArrayList { ticketNumber, (int)propertyId };
return SendCommand<string>(Mt5CommandType.HistoryDealGetString, commandParameters);
}
@@ -1638,6 +1638,568 @@ namespace MtApi5
#endregion //Object Functions
#region Technical Indicators
#endregion //Technical Indicators
///<summary>
///The function creates Accelerator Oscillator in a global cache of the client terminal and returns its handle.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
public int iAC(string symbol, ENUM_TIMEFRAMES period)
{
var commandParameters = new ArrayList { symbol, (int)period };
return SendCommand<int>(Mt5CommandType.iAC, commandParameters);
}
///<summary>
///The function returns the handle of the Accumulation/Distribution indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="appliedVolume">The volume used. Can be any of ENUM_APPLIED_VOLUME values.</param>
public int iAD(string symbol, ENUM_TIMEFRAMES period, ENUM_APPLIED_VOLUME appliedVolume)
{
var commandParameters = new ArrayList { symbol, (int)period, (int)appliedVolume };
return SendCommand<int>(Mt5CommandType.iAD, commandParameters);
}
///<summary>
///The function returns the handle of the Average Directional Movement Index indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="adxPeriod">Period to calculate the index.</param>
public int iADX(string symbol, ENUM_TIMEFRAMES period, int adxPeriod)
{
var commandParameters = new ArrayList { symbol, (int)period, adxPeriod };
return SendCommand<int>(Mt5CommandType.iADX, commandParameters);
}
///<summary>
///The function returns the handle of Average Directional Movement Index by Welles Wilder.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="adxPeriod">Period to calculate the index.</param>
public int iADXWilder(string symbol, ENUM_TIMEFRAMES period, int adxPeriod)
{
var commandParameters = new ArrayList { symbol, (int)period, adxPeriod };
return SendCommand<int>(Mt5CommandType.iADXWilder, commandParameters);
}
///<summary>
///The function returns the handle of the Alligator indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="jawPeriod">Averaging period for the blue line (Alligator's Jaw).</param>
///<param name="jawShift">The shift of the blue line relative to the price chart.</param>
///<param name="teethPeriod">Averaging period for the red line (Alligator's Teeth).</param>
///<param name="teethShift">The shift of the red line relative to the price chart.</param>
///<param name="lipsPeriod">Averaging period for the green line (Alligator's lips).</param>
///<param name="lipsShift">The shift of the green line relative to the price chart.</param>
///<param name="maMethod">The method of averaging. Can be any of the ENUM_MA_METHOD values.</param>
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
public 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)
{
var commandParameters = new ArrayList { symbol, (int)period, jawPeriod, jawShift, teethPeriod, teethShift, lipsPeriod, lipsShift, (int)maMethod, (int)appliedPrice };
return SendCommand<int>(Mt5CommandType.iAlligator, commandParameters);
}
///<summary>
///The function returns the handle of the Adaptive Moving Average indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="amaPeriod">The calculation period, on which the efficiency coefficient is calculated.</param>
///<param name="fastMaPeriod">Fast period for the smoothing coefficient calculation for a rapid market.</param>
///<param name="slowMaPeriod">Slow period for the smoothing coefficient calculation in the absence of trend.</param>
///<param name="amaShift">Shift of the indicator relative to the price chart.</param>
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
public int iAMA(string symbol, ENUM_TIMEFRAMES period, int amaPeriod, int fastMaPeriod, int slowMaPeriod, int amaShift, ENUM_APPLIED_PRICE appliedPrice)
{
var commandParameters = new ArrayList { symbol, (int)period, amaPeriod, fastMaPeriod, slowMaPeriod, amaShift, (int)appliedPrice };
return SendCommand<int>(Mt5CommandType.iAMA, commandParameters);
}
///<summary>
///The function returns the handle of the Awesome Oscillator indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
public int iAO(string symbol, ENUM_TIMEFRAMES period)
{
var commandParameters = new ArrayList { symbol, (int)period };
return SendCommand<int>(Mt5CommandType.iAO, commandParameters);
}
///<summary>
///The function returns the handle of the Average True Range indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="maPeriod">The value of the averaging period for the indicator calculation.</param>
public int iATR(string symbol, ENUM_TIMEFRAMES period, int maPeriod)
{
var commandParameters = new ArrayList { symbol, (int)period, maPeriod };
return SendCommand<int>(Mt5CommandType.iATR, commandParameters);
}
///<summary>
///The function returns the handle of the Bears Power indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="maPeriod">The value of the averaging period for the indicator calculation.</param>
public int iBearsPower(string symbol, ENUM_TIMEFRAMES period, int maPeriod)
{
var commandParameters = new ArrayList { symbol, (int)period, maPeriod };
return SendCommand<int>(Mt5CommandType.iBearsPower, commandParameters);
}
///<summary>
///The function returns the handle of the Bollinger Bands® indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="bandsPeriod">The averaging period of the main line of the indicator.</param>
///<param name="bandsShift">The shift the indicator relative to the price chart.</param>
///<param name="deviation">Deviation from the main line.</param>
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
public int iBands(string symbol, ENUM_TIMEFRAMES period, int bandsPeriod, int bandsShift, double deviation, ENUM_APPLIED_PRICE appliedPrice)
{
var commandParameters = new ArrayList { symbol, (int)period, bandsPeriod, bandsShift, deviation, (int)appliedPrice };
return SendCommand<int>(Mt5CommandType.iBands, commandParameters);
}
///<summary>
///The function returns the handle of the Bulls Power indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="maPeriod">The averaging period for the indicator calculation.</param>
public int iBullsPower(string symbol, ENUM_TIMEFRAMES period, int maPeriod)
{
var commandParameters = new ArrayList { symbol, (int)period, maPeriod };
return SendCommand<int>(Mt5CommandType.iBullsPower, commandParameters);
}
///<summary>
///The function returns the handle of the Commodity Channel Index indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="maPeriod">The averaging period for the indicator calculation.</param>
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
public int iCCI(string symbol, ENUM_TIMEFRAMES period, int maPeriod, ENUM_APPLIED_PRICE appliedPrice)
{
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, (int)appliedPrice };
return SendCommand<int>(Mt5CommandType.iCCI, commandParameters);
}
///<summary>
///The function returns the handle of the Bulls Power indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="fastMaPeriod">Fast averaging period for calculations.</param>
///<param name="slowMaPeriod">Slow averaging period for calculations.</param>
///<param name="maMethod">Smoothing type. Can be one of the averaging constants of ENUM_MA_METHOD.</param>
///<param name="appliedVolume">The volume used. Can be one of the constants of ENUM_APPLIED_VOLUME.</param>
public int iChaikin(string symbol, ENUM_TIMEFRAMES period, int fastMaPeriod, int slowMaPeriod, ENUM_MA_METHOD maMethod, ENUM_APPLIED_VOLUME appliedVolume)
{
var commandParameters = new ArrayList { symbol, (int)period, fastMaPeriod, slowMaPeriod, (int)maMethod, (int)appliedVolume };
return SendCommand<int>(Mt5CommandType.iChaikin, commandParameters);
}
///<summary>
///The function returns the handle of the Bulls Power indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="maPeriod">Averaging period (bars count) for calculations.</param>
///<param name="maShift">Shift of the indicator relative to the price chart.</param>
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
public int iDEMA(string symbol, ENUM_TIMEFRAMES period, int maPeriod, int maShift, ENUM_APPLIED_PRICE appliedPrice)
{
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, maShift, (int)appliedPrice };
return SendCommand<int>(Mt5CommandType.iDEMA, commandParameters);
}
///<summary>
///The function returns the handle of the DeMarker indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="maPeriod">Averaging period (bars count) for calculations.</param>
public int iDeMarker(string symbol, ENUM_TIMEFRAMES period, int maPeriod)
{
var commandParameters = new ArrayList { symbol, (int)period, maPeriod };
return SendCommand<int>(Mt5CommandType.iDeMarker, commandParameters);
}
///<summary>
///The function returns the handle of the Envelopes indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="maPeriod">Averaging period for the main line.</param>
///<param name="maShift">The shift of the indicator relative to the price chart.</param>
///<param name="maMethod">Smoothing type. Can be one of the values of ENUM_MA_METHOD.</param>
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
///<param name="deviation">The deviation from the main line (in percents).</param>
public int iEnvelopes(string symbol, ENUM_TIMEFRAMES period, int maPeriod, int maShift, ENUM_MA_METHOD maMethod, ENUM_APPLIED_PRICE appliedPrice, double deviation)
{
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, maShift, (int)maMethod, (int)appliedPrice, deviation };
return SendCommand<int>(Mt5CommandType.iEnvelopes, commandParameters);
}
///<summary>
///The function returns the handle of the Force Index indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="maPeriod">Averaging period for the indicator calculations.</param>
///<param name="maMethod">Smoothing type. Can be one of the values of ENUM_MA_METHOD.</param>
///<param name="appliedVolume">The volume used. Can be one of the values of ENUM_APPLIED_VOLUME.</param>
public int iForce(string symbol, ENUM_TIMEFRAMES period, int maPeriod, ENUM_MA_METHOD maMethod, ENUM_APPLIED_VOLUME appliedVolume)
{
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, (int)maMethod, (int)appliedVolume };
return SendCommand<int>(Mt5CommandType.iForce, commandParameters);
}
///<summary>
///The function returns the handle of the Force Index indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
public int iForce(string symbol, ENUM_TIMEFRAMES period)
{
var commandParameters = new ArrayList { symbol, (int)period };
return SendCommand<int>(Mt5CommandType.iForce, commandParameters);
}
///<summary>
///The function returns the handle of the Fractal Adaptive Moving Average indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="maPeriod">Period (bars count) for the indicator calculations.</param>
///<param name="maShift">Shift of the indicator in the price chart.</param>
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
public int iFrAMA(string symbol, ENUM_TIMEFRAMES period, int maPeriod, int maShift, ENUM_APPLIED_PRICE appliedPrice)
{
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, maShift, (int)appliedPrice };
return SendCommand<int>(Mt5CommandType.iFrAMA, commandParameters);
}
///<summary>
///The function returns the handle of the Gator indicator. The Oscillator shows the difference between the blue and red lines of Alligator (upper histogram) and difference between red and green lines (lower histogram).
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="jawPeriod">Averaging period for the blue line (Alligator's Jaw).</param>
///<param name="jawShift">The shift of the blue line relative to the price chart. It isn't directly connected with the visual shift of the indicator histogram.</param>
///<param name="teethPeriod">Averaging period for the red line (Alligator's Teeth).</param>
///<param name="teethShift">The shift of the red line relative to the price chart. It isn't directly connected with the visual shift of the indicator histogram.</param>
///<param name="lipsPeriod">Averaging period for the green line (Alligator's lips).</param>
///<param name="lipsShift">The shift of the green line relative to the price charts. It isn't directly connected with the visual shift of the indicator histogram.</param>
///<param name="maMethod">Smoothing type. Can be one of the values of ENUM_MA_METHOD.</param>
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
public 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)
{
var commandParameters = new ArrayList { symbol, (int)period, jawPeriod, jawShift, teethPeriod, teethShift, lipsPeriod, lipsShift, (int)maMethod, (int)appliedPrice };
return SendCommand<int>(Mt5CommandType.iGator, commandParameters);
}
///<summary>
///The function returns the handle of the Ichimoku Kinko Hyo indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="tenkanSen">Averaging period for Tenkan Sen.</param>
///<param name="kijunSen">Averaging period for Kijun Sen.</param>
///<param name="senkouSpanB">Averaging period for Senkou Span B.</param>
public int iIchimoku(string symbol, ENUM_TIMEFRAMES period, int tenkanSen, int kijunSen, int senkouSpanB)
{
var commandParameters = new ArrayList { symbol, (int)period, tenkanSen, kijunSen, senkouSpanB };
return SendCommand<int>(Mt5CommandType.iIchimoku, commandParameters);
}
///<summary>
///The function returns the handle of the Market Facilitation Index indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="appliedVolume">The volume used. Can be one of the constants of ENUM_APPLIED_VOLUME.</param>
public int iBWMFI(string symbol, ENUM_TIMEFRAMES period, ENUM_APPLIED_VOLUME appliedVolume)
{
var commandParameters = new ArrayList { symbol, (int)period, (int)appliedVolume };
return SendCommand<int>(Mt5CommandType.iBWMFI, commandParameters);
}
///<summary>
///The function returns the handle of the Momentum indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="momPeriod">Averaging period (bars count) for the calculation of the price change.</param>
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
public int iMomentum(string symbol, ENUM_TIMEFRAMES period, int momPeriod, ENUM_APPLIED_PRICE appliedPrice)
{
var commandParameters = new ArrayList { symbol, (int)period, momPeriod, (int)appliedPrice };
return SendCommand<int>(Mt5CommandType.iMomentum, commandParameters);
}
///<summary>
///The function returns the handle of the Money Flow Index indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="maPeriod">Averaging period (bars count) for the calculation.</param>
///<param name="appliedVolume">The volume used. Can be any of the ENUM_APPLIED_VOLUME values.</param>
public int iMFI(string symbol, ENUM_TIMEFRAMES period, int maPeriod, ENUM_APPLIED_VOLUME appliedVolume)
{
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, (int)appliedVolume };
return SendCommand<int>(Mt5CommandType.iMFI, commandParameters);
}
///<summary>
///The function returns the handle of the Moving Average indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="maPeriod">Averaging period for the calculation of the moving average.</param>
///<param name="maShift">Shift of the indicator relative to the price chart.</param>
///<param name="maMethod">Smoothing type. Can be one of the ENUM_MA_METHOD values.</param>
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
public int iMA(string symbol, ENUM_TIMEFRAMES period, int maPeriod, int maShift, ENUM_MA_METHOD maMethod, ENUM_APPLIED_PRICE appliedPrice)
{
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, maShift, (int)maMethod, (int)appliedPrice };
return SendCommand<int>(Mt5CommandType.iMA, commandParameters);
}
///<summary>
///The function returns the handle of the Moving Average of Oscillator indicator. The OsMA oscillator shows the difference between values of MACD and its signal line.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="fastEmaPeriod">Period for Fast Moving Average calculation.</param>
///<param name="slowEmaPeriod">Period for Slow Moving Average calculation.</param>
///<param name="signalPeriod">Averaging period for signal line calculation.</param>
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
public int iOsMA(string symbol, ENUM_TIMEFRAMES period, int fastEmaPeriod, int slowEmaPeriod, int signalPeriod, ENUM_APPLIED_PRICE appliedPrice)
{
var commandParameters = new ArrayList { symbol, (int)period, fastEmaPeriod, slowEmaPeriod, signalPeriod, (int)appliedPrice };
return SendCommand<int>(Mt5CommandType.iOsMA, commandParameters);
}
///<summary>
///The function returns the handle of the Moving Averages Convergence/Divergence indicator. In systems where OsMA is called MACD Histogram, this indicator is shown as two lines. In the client terminal the Moving Averages Convergence/Divergence looks like a histogram.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="fastEmaPeriod">Period for Fast Moving Average calculation.</param>
///<param name="slowEmaPeriod">Period for Slow Moving Average calculation.</param>
///<param name="signalPeriod">Averaging period for signal line calculation.</param>
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
public int iMACD(string symbol, ENUM_TIMEFRAMES period, int fastEmaPeriod, int slowEmaPeriod, int signalPeriod, ENUM_APPLIED_PRICE appliedPrice)
{
var commandParameters = new ArrayList { symbol, (int)period, fastEmaPeriod, slowEmaPeriod, signalPeriod, (int)appliedPrice };
return SendCommand<int>(Mt5CommandType.iMACD, commandParameters);
}
///<summary>
///The function returns the handle of the On Balance Volume indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="appliedVolume">The volume used. Can be any of the ENUM_APPLIED_VOLUME values.</param>
public int iOBV(string symbol, ENUM_TIMEFRAMES period, ENUM_APPLIED_VOLUME appliedVolume)
{
var commandParameters = new ArrayList { symbol, (int)period, (int)appliedVolume };
return SendCommand<int>(Mt5CommandType.iOBV, commandParameters);
}
///<summary>
///The function returns the handle of the Parabolic Stop and Reverse system indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="step">The step of price increment, usually 0.02.</param>
///<param name="maximum">The maximum step, usually 0.2.</param>
public int iSAR(string symbol, ENUM_TIMEFRAMES period, double step, double maximum)
{
var commandParameters = new ArrayList { symbol, (int)period, step, maximum };
return SendCommand<int>(Mt5CommandType.iSAR, commandParameters);
}
///<summary>
///The function returns the handle of the Relative Strength Index indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="maPeriod">Averaging period for the RSI calculation.</param>
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
public int iRSI(string symbol, ENUM_TIMEFRAMES period, int maPeriod, ENUM_APPLIED_PRICE appliedPrice)
{
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, (int)appliedPrice };
return SendCommand<int>(Mt5CommandType.iRSI, commandParameters);
}
///<summary>
///The function returns the handle of the Relative Vigor Index indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="maPeriod">Averaging period for the RVI calculation.</param>
public int iRVI(string symbol, ENUM_TIMEFRAMES period, int maPeriod)
{
var commandParameters = new ArrayList { symbol, (int)period, maPeriod };
return SendCommand<int>(Mt5CommandType.iRVI, commandParameters);
}
///<summary>
///The function returns the handle of the Standard Deviation indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="maPeriod">Averaging period for the RVI calculation.</param>
///<param name="maShift">Shift of the indicator relative to the price chart.</param>
///<param name="maMethod">Type of averaging. Can be any of the ENUM_MA_METHOD values.</param>
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
public int iStdDev(string symbol, ENUM_TIMEFRAMES period, int maPeriod, int maShift, ENUM_MA_METHOD maMethod, ENUM_APPLIED_PRICE appliedPrice)
{
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, maShift, (int)maMethod, (int)appliedPrice };
return SendCommand<int>(Mt5CommandType.iStdDev, commandParameters);
}
///<summary>
///The function returns the handle of the Stochastic Oscillator indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="Kperiod">Averaging period (bars count) for the %K line calculation.</param>
///<param name="Dperiod">Averaging period (bars count) for the %D line calculation.</param>
///<param name="slowing">Slowing value.</param>
///<param name="maMethod">Type of averaging. Can be any of the ENUM_MA_METHOD values.</param>
///<param name="priceField">Parameter of price selection for calculations. Can be one of the ENUM_STO_PRICE values.</param>
public int iStochastic(string symbol, ENUM_TIMEFRAMES period, int Kperiod, int Dperiod, int slowing, ENUM_MA_METHOD maMethod, ENUM_STO_PRICE priceField)
{
var commandParameters = new ArrayList { symbol, (int)period, Kperiod, Dperiod, slowing, (int)maMethod, (int)priceField };
return SendCommand<int>(Mt5CommandType.iStochastic, commandParameters);
}
///<summary>
///The function returns the handle of the Triple Exponential Moving Average indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="maPeriod">Averaging period (bars count) for calculation.</param>
///<param name="maShift">Shift of indicator relative to the price chart.</param>
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
public int iTEMA(string symbol, ENUM_TIMEFRAMES period, int maPeriod, int maShift, ENUM_APPLIED_PRICE appliedPrice)
{
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, maShift, (int)appliedPrice };
return SendCommand<int>(Mt5CommandType.iTEMA, commandParameters);
}
///<summary>
///The function returns the handle of the Triple Exponential Moving Averages Oscillator indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="maPeriod">Averaging period (bars count) for calculation.</param>
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
public int iTriX(string symbol, ENUM_TIMEFRAMES period, int maPeriod, ENUM_APPLIED_PRICE appliedPrice)
{
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, (int)appliedPrice };
return SendCommand<int>(Mt5CommandType.iTriX, commandParameters);
}
///<summary>
///The function returns the handle of the Larry Williams' Percent Range indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="calcPeriod">Period (bars count) for the indicator calculation.</param>
public int iWPR(string symbol, ENUM_TIMEFRAMES period, int calcPeriod)
{
var commandParameters = new ArrayList { symbol, (int)period, calcPeriod };
return SendCommand<int>(Mt5CommandType.iWPR, commandParameters);
}
///<summary>
///The function returns the handle of the Variable Index Dynamic Average indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="cmoPeriod">Period (bars count) for the Chande Momentum Oscillator calculation.</param>
///<param name="emaPeriod">EMA period (bars count) for smoothing factor calculation.</param>
///<param name="maShift">Shift of the indicator relative to the price chart.</param>
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
public int iVIDyA(string symbol, ENUM_TIMEFRAMES period, int cmoPeriod, int emaPeriod, int maShift, ENUM_APPLIED_PRICE appliedPrice)
{
var commandParameters = new ArrayList { symbol, (int)period, cmoPeriod, emaPeriod, maShift, (int)appliedPrice };
return SendCommand<int>(Mt5CommandType.iVIDyA, commandParameters);
}
///<summary>
///The function returns the handle of the Volumes indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="appliedVolume">The volume used. Can be any of the ENUM_APPLIED_VOLUME values.</param>
public int iVolumes(string symbol, ENUM_TIMEFRAMES period, ENUM_APPLIED_VOLUME appliedVolume)
{
var commandParameters = new ArrayList { symbol, (int)period, (int)appliedVolume };
return SendCommand<int>(Mt5CommandType.iVolumes, commandParameters);
}
///<summary>
///The function returns the handle of the Volumes indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="name">The name of the custom indicator, with path relative to the root directory of indicators (MQL5/Indicators/). If an indicator is located in a subdirectory, for example, in MQL5/Indicators/Examples, its name must be specified like: "Examples\\indicator_name" (it is necessary to use a double slash instead of the single slash as a separator).</param>
///<param name="parameters">input-parameters of a custom indicator. If there is no parameters specified, then default values will be used.</param>
public int iCustom(string symbol, ENUM_TIMEFRAMES period, string name, double[] parameters)
{
var response = SendRequest<ICustomResponse>(new ICustomRequest
{
Symbol = symbol,
Timeframe = (int)period,
Name = name,
Params = new ArrayList(parameters),
ParamsType = ICustomRequest.ParametersType.Double
});
return response?.Value ?? 0;
}
///<summary>
///The function returns the handle of the Volumes indicator.
///</summary>
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
///<param name="name">The name of the custom indicator, with path relative to the root directory of indicators (MQL5/Indicators/). If an indicator is located in a subdirectory, for example, in MQL5/Indicators/Examples, its name must be specified like: "Examples\\indicator_name" (it is necessary to use a double slash instead of the single slash as a separator).</param>
///<param name="parameters">input-parameters of a custom indicator. If there is no parameters specified, then default values will be used.</param>
public int iCustom(string symbol, ENUM_TIMEFRAMES period, string name, int[] parameters)
{
var response = SendRequest<ICustomResponse>(new ICustomRequest
{
Symbol = symbol,
Timeframe = (int)period,
Name = name,
Params = new ArrayList(parameters),
ParamsType = ICustomRequest.ParametersType.Int
});
return response?.Value ?? 0;
}
#endregion // Public Methods
#region Properties
@@ -1888,8 +2450,7 @@ namespace MtApi5
private void OnConnected()
{
// INFO: disabled backtesting mode while solution of window handle in testing mode is not found
//_isBacktestingMode = IsTestMode();
_isBacktestingMode = IsTesting();
if (_isBacktestingMode)
{
+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.13")]
[assembly: AssemblyFileVersion("1.0.13")]
[assembly: AssemblyVersion("1.0.15")]
[assembly: AssemblyFileVersion("1.0.15")]
+23
View File
@@ -0,0 +1,23 @@
using System.Collections;
namespace MtApi5.Requests
{
internal class ICustomRequest : RequestBase
{
public enum ParametersType
{
Int = 0,
Double = 1,
String = 2,
Boolean = 3
}
public string Symbol { get; set; }
public int Timeframe { get; set; }
public string Name { get; set; }
public ArrayList Params { get; set; }
public ParametersType ParamsType { get; set; }
public override RequestType RequestType => RequestType.iCustom;
}
}
+2 -1
View File
@@ -3,6 +3,7 @@
internal enum RequestType
{
Unknown = 0,
CopyTicks = 1
CopyTicks = 1,
iCustom = 2
}
}
+7
View File
@@ -0,0 +1,7 @@
namespace MtApi5.Responses
{
internal class ICustomResponse: ResponseBase
{
public int Value { get; set; }
}
}
+7 -2
View File
@@ -254,8 +254,13 @@
</Grid>
</Expander>
<StackPanel Grid.Row="1" Orientation="Horizontal">
<Button Content="OrderSend" Command="{Binding OrderSendCommand}" Width="100" Height="25"/>
<StackPanel Grid.Row="1" Orientation="Vertical">
<Button Content="OrderSend" Command="{Binding OrderSendCommand}" Width="100" Height="25" HorizontalAlignment="Left" Margin="4"/>
<Button Content="HistoryDealGetDouble" Command="{Binding HistoryDealGetDoubleCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
<Button Content="HistoryDealGetInteger" Command="{Binding HistoryDealGetIntegerCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
<Button Content="HistoryDealGetString" Command="{Binding HistoryDealGetStringCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
<Button Content="HistoryOrderGetInteger" Command="{Binding HistoryOrderGetIntegerCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
<Button Content="HistoryDealMethods" Command="{Binding HistoryDealMethodsCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
</StackPanel>
</Grid>
+70
View File
@@ -16,6 +16,11 @@ namespace MtApi5TestClient
public DelegateCommand DisconnectCommand { get; private set; }
public DelegateCommand OrderSendCommand { get; private set; }
public DelegateCommand HistoryOrderGetIntegerCommand { get; private set; }
public DelegateCommand HistoryDealGetDoubleCommand { get; private set; }
public DelegateCommand HistoryDealGetIntegerCommand { get; private set; }
public DelegateCommand HistoryDealGetStringCommand { get; private set; }
public DelegateCommand HistoryDealMethodsCommand { get; private set; }
public DelegateCommand AccountInfoDoubleCommand { get; private set; }
public DelegateCommand AccountInfoIntegerCommand { get; private set; }
@@ -193,6 +198,11 @@ namespace MtApi5TestClient
DisconnectCommand = new DelegateCommand(ExecuteDisconnect, CanExecuteDisconnect);
OrderSendCommand = new DelegateCommand(ExecuteOrderSend);
HistoryOrderGetIntegerCommand = new DelegateCommand(ExecuteHistoryOrderGetInteger);
HistoryDealGetDoubleCommand = new DelegateCommand(ExecuteHistoryDealGetDouble);
HistoryDealGetIntegerCommand = new DelegateCommand(ExecuteHistoryDealGetInteger);
HistoryDealGetStringCommand = new DelegateCommand(ExecuteHistoryDealGetString);
HistoryDealMethodsCommand = new DelegateCommand(ExecuteHistoryDealMethods);
AccountInfoDoubleCommand = new DelegateCommand(ExecuteAccountInfoDouble);
AccountInfoIntegerCommand = new DelegateCommand(ExecuteAccountInfoInteger);
@@ -271,6 +281,66 @@ namespace MtApi5TestClient
AddLog(message);
}
private async void ExecuteHistoryOrderGetInteger(object o)
{
const ulong ticket = 12345;
const ENUM_ORDER_PROPERTY_INTEGER propertyId = ENUM_ORDER_PROPERTY_INTEGER.ORDER_POSITION_ID;
var retVal = await Execute(() => _mtApiClient.HistoryOrderGetInteger(ticket, propertyId));
AddLog($"HistoryOrderGetInteger: {retVal}");
}
private async void ExecuteHistoryDealGetDouble(object o)
{
const ulong ticket = 12345;
const ENUM_DEAL_PROPERTY_DOUBLE propertyId = ENUM_DEAL_PROPERTY_DOUBLE.DEAL_PROFIT;
var retVal = await Execute(() => _mtApiClient.HistoryDealGetDouble(ticket, propertyId));
AddLog($"HistoryDealGetDouble: {retVal}");
}
private async void ExecuteHistoryDealGetInteger(object o)
{
const ulong ticket = 12345;
const ENUM_DEAL_PROPERTY_INTEGER propertyId = ENUM_DEAL_PROPERTY_INTEGER.DEAL_TICKET;
var retVal = await Execute(() => _mtApiClient.HistoryDealGetInteger(ticket, propertyId));
AddLog($"HistoryDealGetInteger: {retVal}");
}
private async void ExecuteHistoryDealGetString(object o)
{
const ulong ticket = 12345;
const ENUM_DEAL_PROPERTY_STRING propertyId = ENUM_DEAL_PROPERTY_STRING.DEAL_SYMBOL;
var retVal = await Execute(() => _mtApiClient.HistoryDealGetString(ticket, propertyId));
AddLog($"HistoryDealGetString: {retVal}");
}
private async void ExecuteHistoryDealMethods(object o)
{
try
{
var posId = await Execute(() => _mtApiClient.PositionGetInteger(ENUM_POSITION_PROPERTY_INTEGER.POSITION_IDENTIFIER)); // posId = 7247951
var history = await Execute(() => _mtApiClient.HistorySelectByPosition(posId)); // history = true
var historyDealsTotal = await Execute(() => _mtApiClient.HistoryDealsTotal()); // historyDealsCount = 4
var histDealTicket = await Execute(() => _mtApiClient.HistoryDealGetTicket(0)); // histDealTicket = 6632442
var histDealPrice = await Execute(() => _mtApiClient.HistoryDealGetDouble(histDealTicket, ENUM_DEAL_PROPERTY_DOUBLE.DEAL_PRICE)); // Exception
}
catch (Exception ex)
{
// ex.Messsage = "Service connection failed! Ошибка сериализации параметра http://tempuri.org/:command. Сообщение InnerException было \"Тип \"MtApi5.ENUM_DEAL_PROPERTY_DOUBLE\" с именем контракта данных \"ENUM_DEAL_PROPERTY_DOUBLE:http://schemas.datacontract.org/2004/07/MtApi5\" не ожидается. Попробуйте использовать DataContractResolver, если вы используете DataContractSerializer, или добавьте любые статически неизвестные типы в список известных типов - например, используя атрибут KnownTypeAttribute или путем их добавления в список известных типов, передаваемый в сериализатор.\". Подробнее см. InnerException."
AddLog(ex.Message);
return;
}
AddLog("ExecuteHistoryDealMethods: success.");
}
private async void ExecuteAccountInfoDouble(object o)
{
var result = await Execute(() => _mtApiClient.AccountInfoDouble(AccountInfoDoublePropertyId));
+116 -65
View File
@@ -113,6 +113,13 @@
this.label22 = new System.Windows.Forms.Label();
this.textBoxErrorCode = new System.Windows.Forms.TextBox();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.button70 = new System.Windows.Forms.Button();
this.label33 = new System.Windows.Forms.Label();
this.label32 = new System.Windows.Forms.Label();
this.label31 = new System.Windows.Forms.Label();
this.textBoxAccountHost = new System.Windows.Forms.TextBox();
this.textBoxAccountPassword = new System.Windows.Forms.TextBox();
this.textBoxAccountLogin = new System.Windows.Forms.TextBox();
this.button67 = new System.Windows.Forms.Button();
this.button66 = new System.Windows.Forms.Button();
this.button65 = new System.Windows.Forms.Button();
@@ -136,6 +143,8 @@
this.label23 = new System.Windows.Forms.Label();
this.textBoxAccountInfoSymbol = new System.Windows.Forms.TextBox();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.comboBox12 = new System.Windows.Forms.ComboBox();
this.button72 = new System.Windows.Forms.Button();
this.button36 = new System.Windows.Forms.Button();
this.comboBox10 = new System.Windows.Forms.ComboBox();
this.comboBox9 = new System.Windows.Forms.ComboBox();
@@ -182,6 +191,7 @@
this.button14 = new System.Windows.Forms.Button();
this.button13 = new System.Windows.Forms.Button();
this.tabPage7 = new System.Windows.Forms.TabPage();
this.button71 = new System.Windows.Forms.Button();
this.button23 = new System.Windows.Forms.Button();
this.iCustomBtn = new System.Windows.Forms.Button();
this.tabPage8 = new System.Windows.Forms.TabPage();
@@ -202,13 +212,7 @@
this.button4 = new System.Windows.Forms.Button();
this.tabPage11 = new System.Windows.Forms.TabPage();
this.button69 = new System.Windows.Forms.Button();
this.textBoxAccountLogin = new System.Windows.Forms.TextBox();
this.textBoxAccountPassword = new System.Windows.Forms.TextBox();
this.label31 = new System.Windows.Forms.Label();
this.label32 = new System.Windows.Forms.Label();
this.textBoxAccountHost = new System.Windows.Forms.TextBox();
this.label33 = new System.Windows.Forms.Label();
this.button70 = new System.Windows.Forms.Button();
this.button73 = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.groupBox2.SuspendLayout();
@@ -1154,6 +1158,64 @@
this.tabPage3.Text = "Account Information";
this.tabPage3.UseVisualStyleBackColor = true;
//
// button70
//
this.button70.Location = new System.Drawing.Point(371, 292);
this.button70.Name = "button70";
this.button70.Size = new System.Drawing.Size(97, 23);
this.button70.TabIndex = 18;
this.button70.Text = "ChangeAccount";
this.button70.UseVisualStyleBackColor = true;
this.button70.Click += new System.EventHandler(this.button70_Click);
//
// label33
//
this.label33.AutoSize = true;
this.label33.Location = new System.Drawing.Point(168, 269);
this.label33.Name = "label33";
this.label33.Size = new System.Drawing.Size(66, 13);
this.label33.TabIndex = 17;
this.label33.Text = "MT4 Server:";
//
// label32
//
this.label32.AutoSize = true;
this.label32.Location = new System.Drawing.Point(168, 241);
this.label32.Name = "label32";
this.label32.Size = new System.Drawing.Size(56, 13);
this.label32.TabIndex = 17;
this.label32.Text = "Password:";
//
// label31
//
this.label31.AutoSize = true;
this.label31.Location = new System.Drawing.Point(168, 214);
this.label31.Name = "label31";
this.label31.Size = new System.Drawing.Size(36, 13);
this.label31.TabIndex = 17;
this.label31.Text = "Login:";
//
// textBoxAccountHost
//
this.textBoxAccountHost.Location = new System.Drawing.Point(234, 266);
this.textBoxAccountHost.Name = "textBoxAccountHost";
this.textBoxAccountHost.Size = new System.Drawing.Size(238, 20);
this.textBoxAccountHost.TabIndex = 17;
//
// textBoxAccountPassword
//
this.textBoxAccountPassword.Location = new System.Drawing.Point(234, 238);
this.textBoxAccountPassword.Name = "textBoxAccountPassword";
this.textBoxAccountPassword.Size = new System.Drawing.Size(238, 20);
this.textBoxAccountPassword.TabIndex = 16;
//
// textBoxAccountLogin
//
this.textBoxAccountLogin.Location = new System.Drawing.Point(232, 212);
this.textBoxAccountLogin.Name = "textBoxAccountLogin";
this.textBoxAccountLogin.Size = new System.Drawing.Size(238, 20);
this.textBoxAccountLogin.TabIndex = 15;
//
// button67
//
this.button67.Location = new System.Drawing.Point(157, 33);
@@ -1368,6 +1430,8 @@
//
// tabPage4
//
this.tabPage4.Controls.Add(this.comboBox12);
this.tabPage4.Controls.Add(this.button72);
this.tabPage4.Controls.Add(this.button36);
this.tabPage4.Controls.Add(this.comboBox10);
this.tabPage4.Controls.Add(this.comboBox9);
@@ -1391,6 +1455,25 @@
this.tabPage4.Text = "MarketInfo";
this.tabPage4.UseVisualStyleBackColor = true;
//
// comboBox12
//
this.comboBox12.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox12.FormattingEnabled = true;
this.comboBox12.Location = new System.Drawing.Point(13, 188);
this.comboBox12.Name = "comboBox12";
this.comboBox12.Size = new System.Drawing.Size(186, 21);
this.comboBox12.TabIndex = 38;
//
// button72
//
this.button72.Location = new System.Drawing.Point(208, 186);
this.button72.Name = "button72";
this.button72.Size = new System.Drawing.Size(111, 23);
this.button72.TabIndex = 37;
this.button72.Text = "TerminalInfoString";
this.button72.UseVisualStyleBackColor = true;
this.button72.Click += new System.EventHandler(this.button72_Click);
//
// button36
//
this.button36.Location = new System.Drawing.Point(208, 157);
@@ -1785,6 +1868,7 @@
//
// tabPage6
//
this.tabPage6.Controls.Add(this.button73);
this.tabPage6.Controls.Add(this.textBoxPrint);
this.tabPage6.Controls.Add(this.button27);
this.tabPage6.Controls.Add(this.button14);
@@ -1799,14 +1883,14 @@
//
// textBoxPrint
//
this.textBoxPrint.Location = new System.Drawing.Point(13, 86);
this.textBoxPrint.Location = new System.Drawing.Point(13, 108);
this.textBoxPrint.Name = "textBoxPrint";
this.textBoxPrint.Size = new System.Drawing.Size(386, 20);
this.textBoxPrint.TabIndex = 3;
//
// button27
//
this.button27.Location = new System.Drawing.Point(405, 84);
this.button27.Location = new System.Drawing.Point(405, 106);
this.button27.Name = "button27";
this.button27.Size = new System.Drawing.Size(75, 23);
this.button27.TabIndex = 2;
@@ -1836,6 +1920,7 @@
//
// tabPage7
//
this.tabPage7.Controls.Add(this.button71);
this.tabPage7.Controls.Add(this.button23);
this.tabPage7.Controls.Add(this.iCustomBtn);
this.tabPage7.Location = new System.Drawing.Point(4, 40);
@@ -1846,6 +1931,16 @@
this.tabPage7.Text = "Technical Indicators";
this.tabPage7.UseVisualStyleBackColor = true;
//
// button71
//
this.button71.Location = new System.Drawing.Point(6, 64);
this.button71.Name = "button71";
this.button71.Size = new System.Drawing.Size(107, 23);
this.button71.TabIndex = 17;
this.button71.Text = "iBarShift";
this.button71.UseVisualStyleBackColor = true;
this.button71.Click += new System.EventHandler(this.button71_Click);
//
// button23
//
this.button23.Location = new System.Drawing.Point(6, 35);
@@ -2076,63 +2171,15 @@
this.button69.UseVisualStyleBackColor = true;
this.button69.Click += new System.EventHandler(this.button69_Click);
//
// textBoxAccountLogin
// button73
//
this.textBoxAccountLogin.Location = new System.Drawing.Point(232, 212);
this.textBoxAccountLogin.Name = "textBoxAccountLogin";
this.textBoxAccountLogin.Size = new System.Drawing.Size(238, 20);
this.textBoxAccountLogin.TabIndex = 15;
//
// textBoxAccountPassword
//
this.textBoxAccountPassword.Location = new System.Drawing.Point(234, 238);
this.textBoxAccountPassword.Name = "textBoxAccountPassword";
this.textBoxAccountPassword.Size = new System.Drawing.Size(238, 20);
this.textBoxAccountPassword.TabIndex = 16;
//
// label31
//
this.label31.AutoSize = true;
this.label31.Location = new System.Drawing.Point(168, 214);
this.label31.Name = "label31";
this.label31.Size = new System.Drawing.Size(36, 13);
this.label31.TabIndex = 17;
this.label31.Text = "Login:";
//
// label32
//
this.label32.AutoSize = true;
this.label32.Location = new System.Drawing.Point(168, 241);
this.label32.Name = "label32";
this.label32.Size = new System.Drawing.Size(56, 13);
this.label32.TabIndex = 17;
this.label32.Text = "Password:";
//
// textBoxAccountHost
//
this.textBoxAccountHost.Location = new System.Drawing.Point(234, 266);
this.textBoxAccountHost.Name = "textBoxAccountHost";
this.textBoxAccountHost.Size = new System.Drawing.Size(238, 20);
this.textBoxAccountHost.TabIndex = 17;
//
// label33
//
this.label33.AutoSize = true;
this.label33.Location = new System.Drawing.Point(168, 269);
this.label33.Name = "label33";
this.label33.Size = new System.Drawing.Size(66, 13);
this.label33.TabIndex = 17;
this.label33.Text = "MT4 Server:";
//
// button70
//
this.button70.Location = new System.Drawing.Point(371, 292);
this.button70.Name = "button70";
this.button70.Size = new System.Drawing.Size(97, 23);
this.button70.TabIndex = 18;
this.button70.Text = "ChangeAccount";
this.button70.UseVisualStyleBackColor = true;
this.button70.Click += new System.EventHandler(this.button70_Click);
this.button73.Location = new System.Drawing.Point(13, 74);
this.button73.Name = "button73";
this.button73.Size = new System.Drawing.Size(75, 23);
this.button73.TabIndex = 4;
this.button73.Text = "TimeGMT";
this.button73.UseVisualStyleBackColor = true;
this.button73.Click += new System.EventHandler(this.button73_Click);
//
// Form1
//
@@ -2366,6 +2413,10 @@
private System.Windows.Forms.TextBox textBoxAccountPassword;
private System.Windows.Forms.TextBox textBoxAccountLogin;
private System.Windows.Forms.Button button70;
private System.Windows.Forms.Button button71;
private System.Windows.Forms.ComboBox comboBox12;
private System.Windows.Forms.Button button72;
private System.Windows.Forms.Button button73;
}
}
+37
View File
@@ -34,6 +34,7 @@ namespace TestApiClientUI
comboBox9.DataSource = Enum.GetNames(typeof(EnumTerminalInfoInteger));
comboBox10.DataSource = Enum.GetNames(typeof(EnumTerminalInfoDouble));
comboBox11.DataSource = Enum.GetNames(typeof(EnumObject));
comboBox12.DataSource = Enum.GetNames(typeof(ENUM_TERMINAL_INFO_STRING));
comboBoxAccountInfoCmd.DataSource = Enum.GetNames(typeof(TradeOperation));
_apiClient.QuoteUpdated += apiClient_QuoteUpdated;
@@ -615,18 +616,28 @@ namespace TestApiClientUI
listBoxProceHistory.DataSource = items;
}
//TimeCurrent
private void button13_Click(object sender, EventArgs e)
{
var retVal = _apiClient.TimeCurrent();
PrintLog($"TimeCurrent result: {retVal}");
}
//TimeLocal
private void button14_Click(object sender, EventArgs e)
{
var retVal = _apiClient.TimeLocal();
PrintLog($"TimeLocal result: {retVal}");
}
//TimeGMT
private void button73_Click(object sender, EventArgs e)
{
var retVal = _apiClient.TimeGMT();
PrintLog($"TimeGMT result: {retVal}");
}
//RefreshRates
private void buttonRefreshRates_Click(object sender, EventArgs e)
{
var retVal = _apiClient.RefreshRates();
@@ -1129,6 +1140,16 @@ namespace TestApiClientUI
PrintLog($"TerminalInfoDouble: result = {result}");
}
//TerminalInfoString
private async void button72_Click(object sender, EventArgs e)
{
ENUM_TERMINAL_INFO_STRING propId;
Enum.TryParse(comboBox12.Text, out propId);
var result = await Execute(() => _apiClient.TerminalInfoString(propId));
PrintLog($"TerminalInfoString: result = {result}");
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
var checkbox = sender as CheckBox;
@@ -1462,5 +1483,21 @@ namespace TestApiClientUI
var result = await Execute(() => _apiClient.ChangeAccount(login, password, host));
PrintLog($"ChangeAccount result: {result}");
}
//iBarShift
private async void button71_Click(object sender, EventArgs e)
{
const string symbol = "EURUSD";
const ChartPeriod timeframe = ChartPeriod.PERIOD_D1;
var time1 = _apiClient.TimeCurrent();
var time2 = _apiClient.iTime(symbol, timeframe, 5);
var result1 = await Execute(() => _apiClient.iBarShift(symbol, timeframe, time1, true));
var result2 = await Execute(() => _apiClient.iBarShift(symbol, timeframe, time2, true));
PrintLog($"iBarShift result1 = {result1}, time = {time1}");
PrintLog($"iBarShift result2 = {result2}, time = {time2}");
}
}
}
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+1938 -19
View File
File diff suppressed because it is too large Load Diff