Skip to content

Commit

Permalink
Issue #81: Added function TimeGMT into MtApi (MT4)
Browse files Browse the repository at this point in the history
  • Loading branch information
vdemydiuk committed Feb 13, 2018
1 parent a238e5e commit 5c96aeb
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 21 deletions.
6 changes: 6 additions & 0 deletions MtApi/MtApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,12 @@ public DateTime TimeCurrent()
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) };
Expand Down
1 change: 1 addition & 0 deletions MtApi/MtCommandType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ enum MtCommandType
TimeSeconds = 86,
TimeYear = 87,
Year = 88,
TimeGMT = 281,

//Global Variables
GlobalVariableCheck = 89,
Expand Down
55 changes: 34 additions & 21 deletions TestClients/TestApiClientUI/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions TestClients/TestApiClientUI/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -616,18 +616,28 @@ private void button12_Click(object sender, EventArgs e)
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();
Expand Down
Binary file modified mq4/MtApi.ex4
Binary file not shown.
Binary file modified mq4/MtApi.mq4
Binary file not shown.

0 comments on commit 5c96aeb

Please sign in to comment.