Issue #82: Refactored request responses (MtAp5). Added iCustom functions with string and boolean parameters. Added button iCustom in test application (MT5).

This commit is contained in:
vdemydiuk
2018-02-19 11:07:37 +02:00
parent 521d7ea2c0
commit 29f501b055
11 changed files with 92 additions and 50 deletions
@@ -402,6 +402,12 @@
<Button Command="{Binding PositionOpenCommand}" Content="PositionOpen" Margin="2"/>
</WrapPanel>
</TabItem>
<TabItem Header="Indicators">
<WrapPanel VerticalAlignment="Top" Margin="5">
<Button Command="{Binding iCustomCommand}" Content="iCustom" Margin="2"/>
</WrapPanel>
</TabItem>
</TabControl>
<Expander Grid.Row="2" Header="History" IsExpanded="True">
+15
View File
@@ -55,6 +55,8 @@ namespace MtApi5TestClient
public DelegateCommand PositionOpenCommand { get; private set; }
public DelegateCommand PrintCommand { get; private set; }
public DelegateCommand iCustomCommand { get; private set; }
#endregion
#region Properties
@@ -237,6 +239,8 @@ namespace MtApi5TestClient
PositionOpenCommand = new DelegateCommand(ExecutePositionOpen);
PrintCommand = new DelegateCommand(ExecutePrint);
iCustomCommand = new DelegateCommand(ExecuteICustom);
}
private bool CanExecuteConnect(object o)
@@ -832,6 +836,17 @@ namespace MtApi5TestClient
AddLog($"Print: message print in MetaTrader - {retVal}");
}
private async void ExecuteICustom(object o)
{
const string symbol = "EURUSD";
const ENUM_TIMEFRAMES timeframe = ENUM_TIMEFRAMES.PERIOD_H1;
const string name = @"Examples\Custom Moving Average";
int[] parameters = { 0, 21, (int)ENUM_APPLIED_PRICE.PRICE_CLOSE };
var retVal = await Execute(() => _mtApiClient.iCustom(symbol, timeframe, name, parameters));
AddLog($"Custom Moving Average: result - {retVal}");
}
private static void RunOnUiThread(Action action)
{
Application.Current?.Dispatcher.Invoke(action);