Commands to handle with Terminal:

- TerminalInfoDoublePropertyId
- TerminalInfoIntegerPropertyId
- TerminalInfoStringPropertyId
This commit is contained in:
Janderson
2018-03-12 22:37:06 -03:00
parent 02774d7328
commit 8eb4bcfabe
4 changed files with 152 additions and 10 deletions
+3 -3
View File
@@ -2108,7 +2108,7 @@ namespace MtApi5
#region Commands of Terminal
///<summary>
///Returns the value of a corresponding property of the mql4 program environment.
///Returns the value of a corresponding property of the mql5 program environment.
///</summary>
///<param name="propertyId">Identifier of a property. Can be one of the values of the ENUM_TERMINAL_INFO_STRING enumeration.</param>
///<returns>
@@ -2121,7 +2121,7 @@ namespace MtApi5
}
///<summary>
///Returns the value of a corresponding property of the mql4 program environment.
///Returns the value of a corresponding property of the mql5 program environment.
///</summary>
///<param name="propertyId">Identifier of a property. Can be one of the values of the ENUM_TERMINAL_INFO_INTEGER enumeration.</param>
///<returns>
@@ -2134,7 +2134,7 @@ namespace MtApi5
}
///<summary>
///Returns the value of a corresponding property of the mql4 program environment.
///Returns the value of a corresponding property of the mql5 program environment.
///</summary>
///<param name="propertyId">Identifier of a property. Can be one of the values of the ENUM_TERMINAL_INFO_DOUBLE enumeration.</param>
///<returns>
@@ -78,6 +78,28 @@
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<ObjectDataProvider x:Key="ENUM_TERMINAL_INFO_INTEGER_Key" MethodName="GetValues"
ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="mtapi5:ENUM_TERMINAL_INFO_INTEGER"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<ObjectDataProvider x:Key="ENUM_TERMINAL_INFO_STRING_Key" MethodName="GetValues"
ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="mtapi5:ENUM_TERMINAL_INFO_STRING"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<ObjectDataProvider x:Key="ENUM_TERMINAL_INFO_DOUBLE_Key" MethodName="GetValues"
ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="mtapi5:ENUM_TERMINAL_INFO_DOUBLE"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<ObjectDataProvider x:Key="ENUM_TIMEFRAMES_Key" MethodName="GetValues"
ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
@@ -297,6 +319,47 @@
</Grid>
</TabItem>
<TabItem Header="Terminal Information">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.4*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ComboBox Grid.Column="0" Grid.Row="0"
SelectedItem="{Binding TerminalInfoDoublePropertyId}"
ItemsSource="{Binding Source={StaticResource ENUM_TERMINAL_INFO_DOUBLE_Key}}"/>
<Button Grid.Column="1" Grid.Row="0" Margin="10,0,0,0"
Command="{Binding TerminalInfoDoubleCommand}"
Content="TerminalInfoDouble" HorizontalAlignment="Left" />
<ComboBox Grid.Column="0" Grid.Row="1"
SelectedItem="{Binding TerminalInfoIntegerPropertyId}"
ItemsSource="{Binding Source={StaticResource ENUM_TERMINAL_INFO_INTEGER_Key}}"/>
<Button Grid.Column="1" Grid.Row="1" Margin="10,0,0,0"
Command="{Binding TerminalInfoIntegerCommand}"
Content="TerminalInfoInteger" HorizontalAlignment="Left" />
<ComboBox Grid.Column="0" Grid.Row="2"
SelectedItem="{Binding TerminalInfoStringPropertyId}"
ItemsSource="{Binding Source={StaticResource ENUM_TERMINAL_INFO_STRING_Key}}"/>
<Button Grid.Column="1" Grid.Row="2" Margin="10,0,0,0"
Command="{Binding TerminalInfoStringCommand}"
Content="TerminalInfoString" HorizontalAlignment="Left" />
</Grid>
</Grid>
</TabItem>
<TabItem Header="Timeseries and Indicators Access">
<Grid>
<Grid.ColumnDefinitions>
+40 -2
View File
@@ -32,6 +32,10 @@ namespace MtApi5TestClient
public DelegateCommand AccountInfoIntegerCommand { get; private set; }
public DelegateCommand AccountInfoStringCommand { get; private set; }
public DelegateCommand TerminalInfoDoubleCommand { get; private set; }
public DelegateCommand TerminalInfoIntegerCommand { get; private set; }
public DelegateCommand TerminalInfoStringCommand { get; private set; }
public DelegateCommand CopyRatesCommand { get; private set; }
public DelegateCommand CopyTimesCommand { get; private set; }
public DelegateCommand CopyOpenCommand { get; private set; }
@@ -219,6 +223,11 @@ namespace MtApi5TestClient
public ENUM_ACCOUNT_INFO_INTEGER AccountInfoIntegerPropertyId { get; set; }
public ENUM_ACCOUNT_INFO_STRING AccountInfoStringPropertyId { get; set; }
public ENUM_TERMINAL_INFO_DOUBLE TerminalInfoDoublePropertyId { get; set; }
public ENUM_TERMINAL_INFO_INTEGER TerminalInfoIntegerPropertyId { get; set; }
public ENUM_TERMINAL_INFO_STRING TerminalInfoStringPropertyId { get; set; }
public TimeSeriesValueViewModel TimeSeriesValues { get; set; }
public ObservableCollection<string> TimeSeriesResults { get; } = new ObservableCollection<string>();
@@ -297,6 +306,10 @@ namespace MtApi5TestClient
AccountInfoIntegerCommand = new DelegateCommand(ExecuteAccountInfoInteger);
AccountInfoStringCommand = new DelegateCommand(ExecuteAccountInfoString);
TerminalInfoDoubleCommand = new DelegateCommand(ExecuteTerminalInfoDouble);
TerminalInfoIntegerCommand = new DelegateCommand(ExecuteTerminalInfoInteger);
TerminalInfoStringCommand = new DelegateCommand(ExecuteTerminalInfoString);
CopyRatesCommand = new DelegateCommand(ExecuteCopyRates);
CopyTimesCommand = new DelegateCommand(ExecuteCopyTime);
CopyOpenCommand = new DelegateCommand(ExecuteCopyOpen);
@@ -483,7 +496,7 @@ namespace MtApi5TestClient
{
var result = await Execute(() => _mtApiClient.AccountInfoInteger(AccountInfoIntegerPropertyId));
var message = $"AccountInfoInteger: property_id = {AccountInfoDoublePropertyId}; result = {result}";
var message = $"AccountInfoInteger: property_id = {AccountInfoIntegerPropertyId}; result = {result}";
AddLog(message);
}
@@ -491,10 +504,35 @@ namespace MtApi5TestClient
{
var result = await Execute(() => _mtApiClient.AccountInfoString(AccountInfoStringPropertyId));
var message = $"AccountInfoString: property_id = {AccountInfoDoublePropertyId}; result = {result}";
var message = $"AccountInfoString: property_id = {AccountInfoStringPropertyId}; result = {result}";
AddLog(message);
}
private async void ExecuteTerminalInfoDouble(object o)
{
var result = await Execute(() => _mtApiClient.TerminalInfoDouble(TerminalInfoDoublePropertyId));
var message = $"TerminalInfoDouble: property_id = {TerminalInfoDoublePropertyId}; result = {result}";
AddLog(message);
}
private async void ExecuteTerminalInfoInteger(object o)
{
var result = await Execute(() => _mtApiClient.TerminalInfoInteger(TerminalInfoIntegerPropertyId));
var message = $"TerminalInfoInteger: property_id = {TerminalInfoIntegerPropertyId}; result = {result}";
AddLog(message);
}
private async void ExecuteTerminalInfoString(object o)
{
var result = await Execute(() => _mtApiClient.TerminalInfoString(TerminalInfoStringPropertyId));
var message = $"TerminalInfoString: property_id = {TerminalInfoStringPropertyId}; result = {result}";
AddLog(message);
}
private async void ExecuteCopyTime(object o)
{
if (string.IsNullOrEmpty(TimeSeriesValues?.SymbolValue)) return;
+46 -5
View File
@@ -706,33 +706,37 @@ int executeCommand()
Execute_IndicatorRelease();
break;
case 241: //ChartOpen
Execute_ChartOpen();
break;
case 242: //ChartFirst
Execute_ChartFirst();
break;
case 243: //ChartFirst
Execute_ChartNext();
break;
case 245: //ChartFirst
Execute_ChartSymbol();
break;
case 236: //ChartApplyTemplate
Execute_ChartApplyTemplate();
break;
case 252: //ChartGetString
Execute_ChartGetString();
break;
case 153: //TerminalInfoString
Execute_TerminalInfoString();
break;
case 204: //TerminalInfoInteger
Execute_TerminalInfoInteger();
break;
case 205: //TerminalInfoDouble
Execute_TerminalInfoDouble();
break;
case 132: //GetLastError
@@ -6202,6 +6206,43 @@ void Execute_TerminalInfoString()
}
}
void Execute_TerminalInfoInteger()
{
int propertyId;
if (!getIntValue(ExpertHandle, 0, propertyId, _error))
{
PrintParamError("TerminalInfoInteger", "propertyId", _error);
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
return;
}
if (!sendIntResponse(ExpertHandle, TerminalInfoInteger((ENUM_TERMINAL_INFO_INTEGER)propertyId), _response_error))
{
PrintResponseError("TerminalInfoInteger", _response_error);
}
}
void Execute_TerminalInfoDouble()
{
int propertyId;
if (!getIntValue(ExpertHandle, 0, propertyId, _error))
{
PrintParamError("TerminalInfoDouble", "propertyId", _error);
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
return;
}
if (!sendDoubleResponse(ExpertHandle, TerminalInfoDouble((ENUM_TERMINAL_INFO_DOUBLE)propertyId), _response_error))
{
PrintResponseError("TerminalInfoDouble", _response_error);
}
}
string ExecuteRequest_IndicatorCreate(JSONObject *jo)
{
//Symbol