diff --git a/MtApi/MtApi.csproj b/MtApi/MtApi.csproj index 1276ed05..36d97f70 100755 --- a/MtApi/MtApi.csproj +++ b/MtApi/MtApi.csproj @@ -72,6 +72,7 @@ + @@ -90,6 +91,7 @@ + @@ -97,6 +99,7 @@ + diff --git a/MtApi/MtApiClient.cs b/MtApi/MtApiClient.cs index bb1b947a..7ffc823c 100755 --- a/MtApi/MtApiClient.cs +++ b/MtApi/MtApiClient.cs @@ -1422,6 +1422,12 @@ namespace MtApi var commandParameters = new ArrayList { name, (int)prop_id }; return SendCommand(MtCommandType.SymbolInfoString, commandParameters); ; } + + public MtSession SymbolInfoSession(string symbol, DayOfWeek dayOfWeek, uint index, SessionType type) + { + var responce = SendRequest(new SessionRequest { Symbol = symbol, DayOfWeek = dayOfWeek, SessionIndex = (int)index, SessionType = type }); + return responce != null ? responce.Session : null; + } #endregion #region Private Methods diff --git a/MtApi/MtSession.cs b/MtApi/MtSession.cs new file mode 100644 index 00000000..5a2a7994 --- /dev/null +++ b/MtApi/MtSession.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MtApi +{ + public class MtSession + { + public string Symbol { get; set; } + public DayOfWeek DayOfWeek { get; set; } + public uint Index { get; set; } + public int MtFromTime { get; set; } + public DateTime From + { + get { return MtApiTimeConverter.ConvertFromMtTime(MtFromTime); } + } + public int MtToTime { get; set; } + public DateTime To + { + get { return MtApiTimeConverter.ConvertFromMtTime(MtToTime); } + } + public bool HasData { get; set; } + public SessionType Type { get; set; } + } + + public enum SessionType { Quote, Trade } +} diff --git a/MtApi/Requests/RequestType.cs b/MtApi/Requests/RequestType.cs index 4097d2bb..1d222555 100644 --- a/MtApi/Requests/RequestType.cs +++ b/MtApi/Requests/RequestType.cs @@ -11,6 +11,7 @@ OrderDelete = 6, OrderModify = 7, iCustom = 8, - CopyRates = 9 + CopyRates = 9, + Session = 10, } } \ No newline at end of file diff --git a/MtApi/Requests/SessionRequest.cs b/MtApi/Requests/SessionRequest.cs new file mode 100644 index 00000000..ab836e16 --- /dev/null +++ b/MtApi/Requests/SessionRequest.cs @@ -0,0 +1,17 @@ +using System; + +namespace MtApi.Requests +{ + public class SessionRequest : RequestBase + { + public string Symbol { get; set; } + public DayOfWeek DayOfWeek { get; set; } + public int SessionIndex { get; set; } + public SessionType SessionType { get; set; } + + public override RequestType RequestType + { + get { return RequestType.Session; } + } + } +} \ No newline at end of file diff --git a/MtApi/Responses/SessionResponce.cs b/MtApi/Responses/SessionResponce.cs new file mode 100644 index 00000000..1443c594 --- /dev/null +++ b/MtApi/Responses/SessionResponce.cs @@ -0,0 +1,7 @@ +namespace MtApi.Responses +{ + public class SessionResponce : ResponseBase + { + public MtSession Session { get; set; } + } +} diff --git a/mq4/MtApi.ex4 b/mq4/MtApi.ex4 index a3f9319c..62334b49 100755 Binary files a/mq4/MtApi.ex4 and b/mq4/MtApi.ex4 differ diff --git a/mq4/MtApi.mq4 b/mq4/MtApi.mq4 index 2be6c261..57c7918a 100755 Binary files a/mq4/MtApi.mq4 and b/mq4/MtApi.mq4 differ