mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-06 23:47:51 +00:00
Chart Commands:
- ChartSaveTemplate Implemented
This commit is contained in:
@@ -479,10 +479,11 @@
|
||||
</WrapPanel>
|
||||
</TabItem>
|
||||
<TabItem Header="Chart Functions">
|
||||
<WrapPanel>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding TimeSeriesValues.SymbolValue}" Margin="1"/>
|
||||
<Button Command="{Binding ChartOpenCommand}" Content="ChartOpen"/>
|
||||
<WrapPanel VerticalAlignment="Top" Margin="5">
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding TimeSeriesValues.SymbolValue}" Margin="1"/>
|
||||
<Button Command="{Binding ChartOpenCommand}" Content="ChartOpen"/>
|
||||
<Button Command="{Binding ChartApplyTemplateCommand}" Content="ChartApplyTemplate"/>
|
||||
<Button Command="{Binding ChartSaveTemplateCommand}" Content="ChartSaveTemplate"/>
|
||||
</WrapPanel>
|
||||
</TabItem>
|
||||
<TabItem Header="Time and Date">
|
||||
|
||||
@@ -76,6 +76,7 @@ namespace MtApi5TestClient
|
||||
|
||||
public DelegateCommand ChartOpenCommand { get; private set; }
|
||||
public DelegateCommand ChartApplyTemplateCommand { get; private set; }
|
||||
public DelegateCommand ChartSaveTemplateCommand { get; private set; }
|
||||
|
||||
public DelegateCommand TimeTradeServerCommand { get; private set; }
|
||||
public DelegateCommand TimeLocalCommand { get; private set; }
|
||||
@@ -129,12 +130,38 @@ namespace MtApi5TestClient
|
||||
var TemplateStringContent = File.ReadAllLines(openFileDialog.FileName);
|
||||
var DestPath = $"{MT5Path}\\MQL5{TemplateName}";
|
||||
File.WriteAllLines($"{MT5Path}\\MQL5{TemplateName}", TemplateStringContent);
|
||||
AddLog($"path: {MT5Path}");
|
||||
_mtApiClient.ChartApplyTemplate(ChartId, TemplateName);
|
||||
}
|
||||
return ChartId;
|
||||
});
|
||||
|
||||
if (result == -1)
|
||||
{
|
||||
AddLog("ExecuteChartApplyTemplate: result is null");
|
||||
return;
|
||||
}
|
||||
|
||||
AddLog($"ExecuteChartApplyTemplate: success chartid=>{result}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartSaveTemplate(object o)
|
||||
{
|
||||
|
||||
AddLog($"ExecuteSaveApplyTemplate #1");
|
||||
|
||||
|
||||
var result = await Execute(() =>
|
||||
{
|
||||
|
||||
var MT5Path = _mtApiClient.TerminalInfoString(ENUM_TERMINAL_INFO_STRING.TERMINAL_DATA_PATH);
|
||||
int ChartId = 0; // Actual Chart
|
||||
var TemplateName = "\\Files\\exported.tpl";
|
||||
_mtApiClient.ChartSaveTemplate(ChartId, TemplateName);
|
||||
var DestPath = $"{MT5Path}\\MQL5{TemplateName}";
|
||||
AddLog($"Destination: {TemplateName}");
|
||||
return ChartId;
|
||||
});
|
||||
|
||||
if (result == -1)
|
||||
{
|
||||
AddLog("ChartOpen: result is null");
|
||||
@@ -348,6 +375,7 @@ namespace MtApi5TestClient
|
||||
|
||||
ChartOpenCommand = new DelegateCommand(ExecuteChartOpen);
|
||||
ChartApplyTemplateCommand = new DelegateCommand(ExecuteChartApplyTemplate);
|
||||
ChartSaveTemplateCommand = new DelegateCommand(ExecuteChartSaveTemplate);
|
||||
|
||||
|
||||
TimeCurrentCommand = new DelegateCommand(ExecuteTimeCurrent);
|
||||
|
||||
Reference in New Issue
Block a user