mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-22 23:28:20 +00:00
Updated test application (MT5) to perform testing functions ChartIndicatorAdd, ChartIndicatorGet
This commit is contained in:
@@ -440,20 +440,20 @@
|
|||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
|
|
||||||
<ComboBox Grid.Row="0" Grid.Column="0"
|
<DockPanel Grid.Row="0" LastChildFill="True">
|
||||||
ItemsSource="{Binding Source={StaticResource ENUM_INDICATOR_Key}}"
|
<Button DockPanel.Dock="Right" Command="{Binding IndicatorCreateCommand}" Margin="2"
|
||||||
SelectedItem="{Binding TimeSeriesValues.IndicatorType}"/>
|
Content="IndicatorCreate" HorizontalAlignment="Left" />
|
||||||
<Button Grid.Row="0" Grid.Column="1" Command="{Binding IndicatorCreateCommand}" Margin="2"
|
<ComboBox Margin="2"
|
||||||
Content="IndicatorCreate" HorizontalAlignment="Left" />
|
ItemsSource="{Binding Source={StaticResource ENUM_INDICATOR_Key}}"
|
||||||
<Label Grid.Row="1" Grid.Column="0" Content="Indicator handle:" Margin="2"/>
|
SelectedItem="{Binding TimeSeriesValues.IndicatorType}"/>
|
||||||
<TextBox Grid.Row="1" Grid.Column="0" Margin="2" Width="30" PreviewTextInput="NumberValidationTextBox" Text="{Binding TimeSeriesValues.IndicatorHandle}"></TextBox>
|
</DockPanel>
|
||||||
<Button Grid.Row="1" Grid.Column="1" Command="{Binding IndicatorReleaseCommand}" Margin="2"
|
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||||
Content="IndicatorRelease" HorizontalAlignment="Left" />
|
<Label Content="Indicator handle:" Margin="2"/>
|
||||||
|
<TextBox Margin="2" Width="60" PreviewTextInput="NumberValidationTextBox" Text="{Binding TimeSeriesValues.IndicatorHandle}"/>
|
||||||
|
<Button Command="{Binding IndicatorReleaseCommand}" Margin="2"
|
||||||
|
Content="IndicatorRelease" HorizontalAlignment="Left" />
|
||||||
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
@@ -536,7 +536,9 @@
|
|||||||
<Button Command="{Binding ChartGetDoubleCommand}" Content="ChartGetDouble" Margin="2"/>
|
<Button Command="{Binding ChartGetDoubleCommand}" Content="ChartGetDouble" Margin="2"/>
|
||||||
<Button Command="{Binding ChartGetIntegerCommand}" Content="ChartGetInteger" Margin="2"/>
|
<Button Command="{Binding ChartGetIntegerCommand}" Content="ChartGetInteger" Margin="2"/>
|
||||||
<Button Command="{Binding ChartNavigateCommand}" Content="ChartNavigate" Margin="2"/>
|
<Button Command="{Binding ChartNavigateCommand}" Content="ChartNavigate" Margin="2"/>
|
||||||
|
<Button Command="{Binding ChartIndicatorAddCommand}" Content="ChartIndicatorAdd" Margin="2"/>
|
||||||
<Button Command="{Binding ChartIndicatorDeleteCommand}" Content="ChartIndicatorDelete" Margin="2"/>
|
<Button Command="{Binding ChartIndicatorDeleteCommand}" Content="ChartIndicatorDelete" Margin="2"/>
|
||||||
|
<Button Command="{Binding ChartIndicatorGetCommand}" Content="ChartIndicatorGet" Margin="2"/>
|
||||||
<Button Command="{Binding ChartIndicatorNameCommand}" Content="ChartIndicatorName" Margin="2"/>
|
<Button Command="{Binding ChartIndicatorNameCommand}" Content="ChartIndicatorName" Margin="2"/>
|
||||||
<Button Command="{Binding ChartIndicatorsTotalCommand}" Content="ChartIndicatorsTotal" Margin="2"/>
|
<Button Command="{Binding ChartIndicatorsTotalCommand}" Content="ChartIndicatorsTotal" Margin="2"/>
|
||||||
<Button Command="{Binding ChartWindowOnDroppedCommand}" Content="ChartWindowOnDropped" Margin="2"/>
|
<Button Command="{Binding ChartWindowOnDroppedCommand}" Content="ChartWindowOnDropped" Margin="2"/>
|
||||||
|
|||||||
@@ -92,7 +92,9 @@ namespace MtApi5TestClient
|
|||||||
public DelegateCommand ChartGetDoubleCommand { get; private set; }
|
public DelegateCommand ChartGetDoubleCommand { get; private set; }
|
||||||
public DelegateCommand ChartGetIntegerCommand { get; private set; }
|
public DelegateCommand ChartGetIntegerCommand { get; private set; }
|
||||||
public DelegateCommand ChartNavigateCommand { get; private set; }
|
public DelegateCommand ChartNavigateCommand { get; private set; }
|
||||||
|
public DelegateCommand ChartIndicatorAddCommand { get; private set; }
|
||||||
public DelegateCommand ChartIndicatorDeleteCommand { get; private set; }
|
public DelegateCommand ChartIndicatorDeleteCommand { get; private set; }
|
||||||
|
public DelegateCommand ChartIndicatorGetCommand { get; private set; }
|
||||||
public DelegateCommand ChartIndicatorNameCommand { get; private set; }
|
public DelegateCommand ChartIndicatorNameCommand { get; private set; }
|
||||||
public DelegateCommand ChartIndicatorsTotalCommand { get; private set; }
|
public DelegateCommand ChartIndicatorsTotalCommand { get; private set; }
|
||||||
public DelegateCommand ChartWindowOnDroppedCommand { get; private set; }
|
public DelegateCommand ChartWindowOnDroppedCommand { get; private set; }
|
||||||
@@ -347,7 +349,9 @@ namespace MtApi5TestClient
|
|||||||
ChartGetDoubleCommand = new DelegateCommand(ExecuteChartGetDouble);
|
ChartGetDoubleCommand = new DelegateCommand(ExecuteChartGetDouble);
|
||||||
ChartGetIntegerCommand = new DelegateCommand(ExecuteChartGetInteger);
|
ChartGetIntegerCommand = new DelegateCommand(ExecuteChartGetInteger);
|
||||||
ChartNavigateCommand = new DelegateCommand(ExecuteChartNavigate);
|
ChartNavigateCommand = new DelegateCommand(ExecuteChartNavigate);
|
||||||
|
ChartIndicatorAddCommand = new DelegateCommand(ExecuteChartIndicatorAdd);
|
||||||
ChartIndicatorDeleteCommand = new DelegateCommand(ExecuteChartIndicatorDelete);
|
ChartIndicatorDeleteCommand = new DelegateCommand(ExecuteChartIndicatorDelete);
|
||||||
|
ChartIndicatorGetCommand = new DelegateCommand(ExecuteChartIndicatorGet);
|
||||||
ChartIndicatorNameCommand = new DelegateCommand(ExecuteChartIndicatorName);
|
ChartIndicatorNameCommand = new DelegateCommand(ExecuteChartIndicatorName);
|
||||||
ChartIndicatorsTotalCommand = new DelegateCommand(ExecuteChartIndicatorsTotal);
|
ChartIndicatorsTotalCommand = new DelegateCommand(ExecuteChartIndicatorsTotal);
|
||||||
ChartWindowOnDroppedCommand = new DelegateCommand(ExecuteChartWindowOnDropped);
|
ChartWindowOnDroppedCommand = new DelegateCommand(ExecuteChartWindowOnDropped);
|
||||||
@@ -1324,6 +1328,16 @@ namespace MtApi5TestClient
|
|||||||
AddLog($"ChartNavigate: result {result} for chartid {chartId}");
|
AddLog($"ChartNavigate: result {result} for chartid {chartId}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void ExecuteChartIndicatorAdd(object obj)
|
||||||
|
{
|
||||||
|
var chartId = ChartFunctionsChartIdValue;
|
||||||
|
var symbol = ChartFunctionsSymbolValue;
|
||||||
|
|
||||||
|
var indicatorHandle = await Execute(() => _mtApiClient.iMACD(symbol, ENUM_TIMEFRAMES.PERIOD_CURRENT, 12, 26, 9, ENUM_APPLIED_PRICE.PRICE_CLOSE));
|
||||||
|
var result = await Execute(() => _mtApiClient.ChartIndicatorAdd(chartId, 1, indicatorHandle));
|
||||||
|
AddLog($"ChartIndicatorAdd: result {result} for chartid {chartId} with indicator {indicatorHandle}");
|
||||||
|
}
|
||||||
|
|
||||||
private async void ExecuteChartIndicatorDelete(object o)
|
private async void ExecuteChartIndicatorDelete(object o)
|
||||||
{
|
{
|
||||||
const string shortname = "MACD(12,26,9)";
|
const string shortname = "MACD(12,26,9)";
|
||||||
@@ -1332,6 +1346,14 @@ namespace MtApi5TestClient
|
|||||||
AddLog($"ChartIndicatorDelete: result {result} for chartid {chartId}");
|
AddLog($"ChartIndicatorDelete: result {result} for chartid {chartId}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void ExecuteChartIndicatorGet(object obj)
|
||||||
|
{
|
||||||
|
const string shortname = "MACD(12,26,9)";
|
||||||
|
var chartId = ChartFunctionsChartIdValue;
|
||||||
|
var result = await Execute(() => _mtApiClient.ChartIndicatorGet(chartId, 1, shortname));
|
||||||
|
AddLog($"hartIndicatorGet: result {result} for chartid {chartId}");
|
||||||
|
}
|
||||||
|
|
||||||
private async void ExecuteChartIndicatorName(object obj)
|
private async void ExecuteChartIndicatorName(object obj)
|
||||||
{
|
{
|
||||||
var chartId = ChartFunctionsChartIdValue;
|
var chartId = ChartFunctionsChartIdValue;
|
||||||
|
|||||||
Binary file not shown.
+2
-2
@@ -6113,8 +6113,8 @@ void Execute_ChartIndicatorAdd()
|
|||||||
int indicator_handle;
|
int indicator_handle;
|
||||||
|
|
||||||
GET_LONG_VALUE(0, chart_id, "chart_id")
|
GET_LONG_VALUE(0, chart_id, "chart_id")
|
||||||
GET_INT_VALUE(2, sub_window, "sub_window")
|
GET_INT_VALUE(1, sub_window, "sub_window")
|
||||||
GET_INT_VALUE(3, indicator_handle, "indicator_handle")
|
GET_INT_VALUE(2, indicator_handle, "indicator_handle")
|
||||||
|
|
||||||
#ifdef __DEBUG_LOG__
|
#ifdef __DEBUG_LOG__
|
||||||
PrintFormat("%s: chart_id = %I64d, sub_window = %d, indicator_handle = %d", __FUNCTION__, chart_id, sub_window, indicator_handle);
|
PrintFormat("%s: chart_id = %I64d, sub_window = %d, indicator_handle = %d", __FUNCTION__, chart_id, sub_window, indicator_handle);
|
||||||
|
|||||||
Reference in New Issue
Block a user