Issue #122: Implemented UnlockTicks function in MtApi (MT5)

This commit is contained in:
vdemydiuk
2018-06-05 19:19:35 +03:00
parent 0f717f1cb7
commit 1a5882b75a
14 changed files with 252 additions and 30 deletions
+4 -1
View File
@@ -574,6 +574,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<WrapPanel VerticalAlignment="Top" Margin="5">
@@ -581,7 +582,9 @@
<Button Command="{Binding ResetLastErrorCommand}" Content="ResetLastError" Margin="2"/>
</WrapPanel>
<Grid Margin="10" Grid.Row="1">
<Button Grid.Row="1" Content="UnlockTicks" HorizontalAlignment="Left" Margin="5" Command="{Binding UnlockTicksCommand}"/>
<Grid Margin="10" Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
+15
View File
@@ -121,6 +121,8 @@ namespace MtApi5TestClient
public DelegateCommand GlobalVariableSetOnConditionCommand { get; private set; }
public DelegateCommand GlobalVariablesDeleteAllCommand { get; private set; }
public DelegateCommand GlobalVariablesTotalCommand { get; private set; }
public DelegateCommand UnlockTicksCommand { get; private set; }
#endregion
#region Properties
@@ -289,6 +291,7 @@ namespace MtApi5TestClient
_mtApiClient.QuoteUpdate += mMtApiClient_QuoteUpdate;
_mtApiClient.OnTradeTransaction += mMtApiClient_OnTradeTransaction;
_mtApiClient.OnBookEvent += _mtApiClient_OnBookEvent;
_mtApiClient.OnLastTimeBar += _mtApiClient_OnOnLastTimeBar;
ConnectionState = _mtApiClient.ConnectionState;
ConnectionMessage = "Disconnected";
@@ -424,6 +427,8 @@ namespace MtApi5TestClient
GlobalVariableSetOnConditionCommand = new DelegateCommand(ExecuteGlobalVariableSetOnCondition);
GlobalVariablesDeleteAllCommand = new DelegateCommand(ExecuteGlobalVariablesDeleteAll);
GlobalVariablesTotalCommand = new DelegateCommand(ExecuteGlobalVariablesTotal);
UnlockTicksCommand = new DelegateCommand(ExecuteUnlockTicks);
}
private bool CanExecuteConnect(object o)
@@ -1564,6 +1569,11 @@ namespace MtApi5TestClient
}
#endregion
private void ExecuteUnlockTicks(object o)
{
_mtApiClient.UnlockTicks();
}
private static void RunOnUiThread(Action action)
{
Application.Current?.Dispatcher.Invoke(action);
@@ -1640,6 +1650,11 @@ namespace MtApi5TestClient
AddLog($"OnBookEvent: ExpertHandle = {e.ExpertHandle}, Symbol = {e.Symbol}");
}
private void _mtApiClient_OnOnLastTimeBar(object sender, Mt5TimeBarArgs e)
{
AddLog($"OnBookEvent: ExpertHandle = {e.ExpertHandle}, Symbol = {e.Symbol}, open = {e.Rates.open}, close = {e.Rates.close}, time = {e.Rates.time}, high = {e.Rates.high}, low = {e.Rates.low}");
}
private void AddQuote(Mt5Quote quote)
{
if (_quotesMap.ContainsKey(quote.ExpertHandle))