mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-17 04:38:10 +00:00
Refactored UI test client (MT5)
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
xmlns:mtapi5="clr-namespace:MtApi5;assembly=MtApi5"
|
xmlns:mtapi5="clr-namespace:MtApi5;assembly=MtApi5"
|
||||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||||
xmlns:mtApi5TestClient="clr-namespace:MtApi5TestClient"
|
xmlns:mtApi5TestClient="clr-namespace:MtApi5TestClient"
|
||||||
Title="MainWindow" Height="700" Width="700"
|
Title="MainWindow" Height="700" Width="900"
|
||||||
Closing="Window_Closing">
|
Closing="Window_Closing">
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<DataTemplate x:Key="ConnectionTextBlockTemplate" DataType="{x:Type mtapi5:Mt5ConnectionState}">
|
<DataTemplate x:Key="ConnectionTextBlockTemplate" DataType="{x:Type mtapi5:Mt5ConnectionState}">
|
||||||
@@ -117,9 +117,9 @@
|
|||||||
|
|
||||||
<Grid x:Name="_MainLayout">
|
<Grid x:Name="_MainLayout">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="0.65*"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="0.35*"/>
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
@@ -129,421 +129,446 @@
|
|||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<Grid Margin="10">
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<Grid.ColumnDefinitions>
|
<Border Grid.Row="0" Margin="2" Visibility="Visible" BorderThickness="1" BorderBrush="DarkBlue">
|
||||||
<ColumnDefinition Width="Auto"/>
|
<StackPanel>
|
||||||
<ColumnDefinition Width="150"/>
|
<Grid>
|
||||||
</Grid.ColumnDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Host"/>
|
<TextBlock Grid.Row="0" Grid.Column="0" Text="Host" Margin="5,2,2,2" VerticalAlignment="Center"/>
|
||||||
<TextBox Grid.Row="0" Grid.Column="1"
|
<TextBox Grid.Row="0" Grid.Column="1" Margin="2" Text="{Binding Host, UpdateSourceTrigger=PropertyChanged}"/>
|
||||||
Margin="5,0,0,0"
|
<TextBlock Grid.Row="1" Grid.Column="0" Text="Port" Margin="5,2,2,2" VerticalAlignment="Center"/>
|
||||||
Text="{Binding Host, UpdateSourceTrigger=PropertyChanged}"/>
|
<TextBox Grid.Row="1" Grid.Column="1" Margin="2" Width="70" HorizontalAlignment="Left" Text="{Binding Port, UpdateSourceTrigger=PropertyChanged}"/>
|
||||||
|
</Grid>
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="30,5,0,10" >
|
||||||
|
<Button Content="Connect" Width="70" Command="{Binding ConnectCommand}" />
|
||||||
|
<Button Margin="10,0,0,0" Width="70" Content="Disconnect" Command="{Binding DisconnectCommand}" />
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Port"/>
|
<Border Grid.Row="3" Margin="2" Visibility="Visible" BorderThickness="1" BorderBrush="DarkBlue">
|
||||||
<TextBox Grid.Row="1" Grid.Column="1"
|
<Grid Margin="3">
|
||||||
Margin="5,0,0,0"
|
<Grid.RowDefinitions>
|
||||||
Text="{Binding Port, UpdateSourceTrigger=PropertyChanged}"/>
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
<StackPanel Grid.Row="2" Grid.ColumnSpan="2" Margin="5" Orientation="Horizontal">
|
</Grid.RowDefinitions>
|
||||||
<Button Content="Connect" Width="70" Command="{Binding ConnectCommand}" />
|
<Label Grid.Row="0" Content="Quotes" Background="LightYellow" />
|
||||||
<Button Margin="5,0,0,0" Width="70" Content="Disconnect" Command="{Binding DisconnectCommand}" />
|
<ListView Grid.Row="1" Margin="2"
|
||||||
</StackPanel>
|
ItemsSource="{Binding Quotes}"
|
||||||
|
SelectedItem="{Binding SelectedQuote}"
|
||||||
|
SelectionMode="Single">
|
||||||
|
<ListView.View>
|
||||||
|
<GridView>
|
||||||
|
<GridViewColumn Width="100" Header="Instrument" DisplayMemberBinding="{Binding Instrument}" />
|
||||||
|
<GridViewColumn Width="70" Header="Bid" DisplayMemberBinding="{Binding Bid}" />
|
||||||
|
<GridViewColumn Width="70" Header="Ask" DisplayMemberBinding="{Binding Ask}" />
|
||||||
|
<GridViewColumn Width="80" Header="ExpertHandle" DisplayMemberBinding="{Binding ExpertHandle}" />
|
||||||
|
</GridView>
|
||||||
|
</ListView.View>
|
||||||
|
</ListView>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<ListView Grid.Row="0" Grid.Column="1"
|
<TabControl Grid.Column="1" Margin="2">
|
||||||
ItemsSource="{Binding Quotes}"
|
<TabItem Header="Trade Functions">
|
||||||
SelectedItem="{Binding SelectedQuote}"
|
<ScrollViewer>
|
||||||
SelectionMode="Single">
|
<Grid>
|
||||||
<ListView.View>
|
<Grid.RowDefinitions>
|
||||||
<GridView>
|
<RowDefinition Height="Auto"/>
|
||||||
<GridViewColumn Width="140" Header="Instrument" DisplayMemberBinding="{Binding Instrument}" />
|
<RowDefinition Height="Auto"/>
|
||||||
<GridViewColumn Width="80" Header="Bid" DisplayMemberBinding="{Binding Bid}" />
|
</Grid.RowDefinitions>
|
||||||
<GridViewColumn Width="80" Header="Ask" DisplayMemberBinding="{Binding Ask}" />
|
|
||||||
<GridViewColumn Width="80" Header="Feeds Count" DisplayMemberBinding="{Binding FeedCount}" />
|
|
||||||
</GridView>
|
|
||||||
</ListView.View>
|
|
||||||
</ListView>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<TabControl Grid.Row="1" >
|
<Expander Header="MqlTradeRequest" Margin="10" IsExpanded="True">
|
||||||
<TabItem Header="Trade Functions">
|
<Grid Margin="0,10,0,0">
|
||||||
<ScrollViewer>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="0" Grid.Row="0" Text="Action"/>
|
||||||
|
<ComboBox Grid.Column="1" Grid.Row="0" ItemsSource="{Binding Source={StaticResource ENUM_TRADE_REQUEST_ACTIONS_Key}}"
|
||||||
|
SelectedItem="{Binding TradeRequest.Action}" Margin="5,0,0,0"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="2" Grid.Row="0" Text="Magic" Margin="10,0,0,0"/>
|
||||||
|
<TextBox Grid.Column="3" Grid.Row="0" Text="{Binding TradeRequest.Magic}" Margin="5,0,0,0"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="0" Grid.Row="1" Text="Order"/>
|
||||||
|
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding TradeRequest.Order}" Margin="5,0,0,0"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="2" Grid.Row="1" Text="Symbol" Margin="10,0,0,0"/>
|
||||||
|
<TextBox Grid.Column="3" Grid.Row="1" Text="{Binding TradeRequest.Symbol}" Margin="5,0,0,0"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="0" Grid.Row="2" Text="Volume"/>
|
||||||
|
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding TradeRequest.Volume}" Margin="5,0,0,0"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="2" Grid.Row="2" Text="Price" Margin="10,0,0,0"/>
|
||||||
|
<TextBox Grid.Column="3" Grid.Row="2" Text="{Binding TradeRequest.Price}" Margin="5,0,0,0"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="0" Grid.Row="3" Text="Stoplimit"/>
|
||||||
|
<TextBox Grid.Column="1" Grid.Row="3" Text="{Binding TradeRequest.Stoplimit}" Margin="5,0,0,0"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="2" Grid.Row="3" Text="Sl" Margin="10,0,0,0"/>
|
||||||
|
<TextBox Grid.Column="3" Grid.Row="3" Text="{Binding TradeRequest.Sl}" Margin="5,0,0,0"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="0" Grid.Row="4" Text="Tp"/>
|
||||||
|
<TextBox Grid.Column="1" Grid.Row="4" Text="{Binding TradeRequest.Tp}" Margin="5,0,0,0"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="2" Grid.Row="4" Text="Deviation" Margin="10,0,0,0"/>
|
||||||
|
<TextBox Grid.Column="3" Grid.Row="4" Text="{Binding TradeRequest.Deviation}" Margin="5,0,0,0"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="0" Grid.Row="5" Text="Type"/>
|
||||||
|
<ComboBox Grid.Column="1" Grid.Row="5" ItemsSource="{Binding Source={StaticResource ENUM_ORDER_TYPE_Key}}"
|
||||||
|
SelectedItem="{Binding TradeRequest.Type}" Margin="5,0,0,0"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="2" Grid.Row="5" Text="Type_filling" Margin="10,0,0,0"/>
|
||||||
|
<ComboBox Grid.Column="3" Grid.Row="5" ItemsSource="{Binding Source={StaticResource ENUM_ORDER_TYPE_FILLING_Key}}"
|
||||||
|
SelectedItem="{Binding TradeRequest.Type_filling}" Margin="5,0,0,0"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="0" Grid.Row="6" Text="Type_time"/>
|
||||||
|
<ComboBox Grid.Column="1" Grid.Row="6" ItemsSource="{Binding Source={StaticResource ENUM_ORDER_TYPE_TIME_Key}}"
|
||||||
|
SelectedItem="{Binding TradeRequest.Type_time}" Margin="5,0,0,0"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="2" Grid.Row="6" Text="Expiration" Margin="10,0,0,0"/>
|
||||||
|
<TextBox Grid.Column="3" Grid.Row="6" Text="{Binding TradeRequest.Expiration}" Margin="5,0,0,0"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="0" Grid.Row="7" Text="Comment"/>
|
||||||
|
<TextBox Grid.Column="1" Grid.Row="7" Grid.ColumnSpan="3" Text="{Binding TradeRequest.Comment}" Margin="5,0,0,0"/>
|
||||||
|
</Grid>
|
||||||
|
</Expander>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="1" Orientation="Vertical">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Button Content="OrderSend" Command="{Binding OrderSendCommand}" Width="100" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
||||||
|
<Button Content="OrderCheck" Command="{Binding OrderCheckCommand}" Width="100" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
||||||
|
<Button Content="PositionGetTicket" Command="{Binding PositionGetTicketCommand}" Width="100" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<WrapPanel>
|
||||||
|
<Button Content="HistoryDealGetDouble" Command="{Binding HistoryDealGetDoubleCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
||||||
|
<Button Content="HistoryDealGetInteger" Command="{Binding HistoryDealGetIntegerCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
||||||
|
<Button Content="HistoryDealGetString" Command="{Binding HistoryDealGetStringCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
||||||
|
<Button Content="HistoryOrderGetInteger" Command="{Binding HistoryOrderGetIntegerCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
||||||
|
<Button Content="HistoryDealMethods" Command="{Binding HistoryDealMethodsCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
||||||
|
</WrapPanel>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</ScrollViewer>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Account Information">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
</Grid.RowDefinitions>
|
</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>
|
||||||
|
|
||||||
<Expander Header="MqlTradeRequest" Margin="10">
|
<ComboBox Grid.Column="0" Grid.Row="0"
|
||||||
<Grid Margin="0,10,0,0">
|
SelectedItem="{Binding AccountInfoDoublePropertyId}"
|
||||||
<Grid.ColumnDefinitions>
|
ItemsSource="{Binding Source={StaticResource ENUM_ACCOUNT_INFO_DOUBLE_Key}}"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<Button Grid.Column="1" Grid.Row="0" Margin="10,0,0,0"
|
||||||
<ColumnDefinition Width="*"/>
|
Command="{Binding AccountInfoDoubleCommand}"
|
||||||
<ColumnDefinition Width="Auto"/>
|
Content="AccountInfoDouble" HorizontalAlignment="Left" />
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
<ComboBox Grid.Column="0" Grid.Row="1"
|
||||||
|
SelectedItem="{Binding AccountInfoIntegerPropertyId}"
|
||||||
|
ItemsSource="{Binding Source={StaticResource ENUM_ACCOUNT_INFO_INTEGER_Key}}"/>
|
||||||
|
<Button Grid.Column="1" Grid.Row="1" Margin="10,0,0,0"
|
||||||
|
Command="{Binding AccountInfoIntegerCommand}"
|
||||||
|
Content="AccountInfoInteger" HorizontalAlignment="Left" />
|
||||||
|
|
||||||
|
<ComboBox Grid.Column="0" Grid.Row="2"
|
||||||
|
SelectedItem="{Binding AccountInfoStringPropertyId}"
|
||||||
|
ItemsSource="{Binding Source={StaticResource ENUM_ACCOUNT_INFO_STRING_Key}}"/>
|
||||||
|
<Button Grid.Column="1" Grid.Row="2" Margin="10,0,0,0"
|
||||||
|
Command="{Binding AccountInfoStringCommand}"
|
||||||
|
Content="AccountInfoString" HorizontalAlignment="Left" />
|
||||||
|
</Grid>
|
||||||
|
</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>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Grid Grid.Column="1" Margin="2">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Grid Grid.Row="0">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
</Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<Grid.ColumnDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<ColumnDefinition Width="*"/>
|
||||||
<RowDefinition Height="Auto"/>
|
</Grid.ColumnDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<TextBlock Grid.Row="0" Text="Symbol Name" Margin="1"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<TextBlock Grid.Row="1" Grid.Column="0" Text="TimeFrame" Margin="1" HorizontalAlignment="Right"/>
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="0" Text="StartPos" Margin="1" HorizontalAlignment="Right"/>
|
||||||
|
<TextBlock Grid.Row="3" Grid.Column="0" Text="Count" Margin="1" HorizontalAlignment="Right"/>
|
||||||
|
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding TimeSeriesValues.SymbolValue}" Margin="1"/>
|
||||||
|
<ComboBox Grid.Row="1" Grid.Column="1" Margin="1"
|
||||||
|
ItemsSource="{Binding Source={StaticResource ENUM_TIMEFRAMES_Key}}"
|
||||||
|
SelectedItem="{Binding TimeSeriesValues.TimeFrame}"/>
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding TimeSeriesValues.StartPos}" Margin="1"/>
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding TimeSeriesValues.Count}" Margin="1"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<WrapPanel Grid.Row="1" Grid.Column="0" Margin="5">
|
||||||
|
<Button Command="{Binding CopyRatesCommand}" Margin="1"
|
||||||
|
Content="CopyRates" HorizontalAlignment="Left" />
|
||||||
|
<Button Command="{Binding CopyTimesCommand}" Margin="1"
|
||||||
|
Content="CopyTimes" HorizontalAlignment="Left" />
|
||||||
|
<Button Command="{Binding CopyOpenCommand}" Margin="1"
|
||||||
|
Content="CopyOpen" HorizontalAlignment="Left" />
|
||||||
|
<Button Command="{Binding CopyHighCommand}" Margin="1"
|
||||||
|
Content="CopyHigh" HorizontalAlignment="Left" />
|
||||||
|
<Button Command="{Binding CopyLowCommand}" Margin="1"
|
||||||
|
Content="CopyLow" HorizontalAlignment="Left" />
|
||||||
|
<Button Command="{Binding CopyCloseCommand}" Margin="1"
|
||||||
|
Content="CopyClose" HorizontalAlignment="Left" />
|
||||||
|
<Button Command="{Binding CopyTickVolumeCommand}" Margin="1"
|
||||||
|
Content="CopyTickVolume" HorizontalAlignment="Left" />
|
||||||
|
<Button Command="{Binding CopyRealVolumeCommand}" Margin="1"
|
||||||
|
Content="CopyRealVolume" HorizontalAlignment="Left" />
|
||||||
|
<Button Command="{Binding CopySpreadCommand}" Margin="1"
|
||||||
|
Content="CopySpread" HorizontalAlignment="Left" />
|
||||||
|
<Button Command="{Binding CopyTicksCommand}" Margin="1"
|
||||||
|
Content="CopyTicks" HorizontalAlignment="Left" />
|
||||||
|
</WrapPanel>
|
||||||
|
|
||||||
|
<Grid Grid.Row="2">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<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>
|
||||||
|
|
||||||
<TextBlock Grid.Column="0" Grid.Row="0" Text="Action"/>
|
<ComboBox Grid.Row="0" Grid.Column="0"
|
||||||
<ComboBox Grid.Column="1" Grid.Row="0" ItemsSource="{Binding Source={StaticResource ENUM_TRADE_REQUEST_ACTIONS_Key}}"
|
ItemsSource="{Binding Source={StaticResource ENUM_INDICATOR_Key}}"
|
||||||
SelectedItem="{Binding TradeRequest.Action}" Margin="5,0,0,0"/>
|
SelectedItem="{Binding TimeSeriesValues.IndicatorType}"/>
|
||||||
|
<Button Grid.Row="0" Grid.Column="1" Command="{Binding IndicatorCreateCommand}" Margin="2"
|
||||||
<TextBlock Grid.Column="2" Grid.Row="0" Text="Magic" Margin="10,0,0,0"/>
|
Content="IndicatorCreate" HorizontalAlignment="Left" />
|
||||||
<TextBox Grid.Column="3" Grid.Row="0" Text="{Binding TradeRequest.Magic}" Margin="5,0,0,0"/>
|
<Label Grid.Row="1" Grid.Column="0" Content="Indicator handle:" Margin="2"/>
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="0" Margin="2" Width="30" PreviewTextInput="NumberValidationTextBox" Text="{Binding TimeSeriesValues.IndicatorHandle}"></TextBox>
|
||||||
<TextBlock Grid.Column="0" Grid.Row="1" Text="Order"/>
|
<Button Grid.Row="1" Grid.Column="1" Command="{Binding IndicatorReleaseCommand}" Margin="2"
|
||||||
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding TradeRequest.Order}" Margin="5,0,0,0"/>
|
Content="IndicatorRelease" HorizontalAlignment="Left" />
|
||||||
|
|
||||||
<TextBlock Grid.Column="2" Grid.Row="1" Text="Symbol" Margin="10,0,0,0"/>
|
|
||||||
<TextBox Grid.Column="3" Grid.Row="1" Text="{Binding TradeRequest.Symbol}" Margin="5,0,0,0"/>
|
|
||||||
|
|
||||||
<TextBlock Grid.Column="0" Grid.Row="2" Text="Volume"/>
|
|
||||||
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding TradeRequest.Volume}" Margin="5,0,0,0"/>
|
|
||||||
|
|
||||||
<TextBlock Grid.Column="2" Grid.Row="2" Text="Price" Margin="10,0,0,0"/>
|
|
||||||
<TextBox Grid.Column="3" Grid.Row="2" Text="{Binding TradeRequest.Price}" Margin="5,0,0,0"/>
|
|
||||||
|
|
||||||
<TextBlock Grid.Column="0" Grid.Row="3" Text="Stoplimit"/>
|
|
||||||
<TextBox Grid.Column="1" Grid.Row="3" Text="{Binding TradeRequest.Stoplimit}" Margin="5,0,0,0"/>
|
|
||||||
|
|
||||||
<TextBlock Grid.Column="2" Grid.Row="3" Text="Sl" Margin="10,0,0,0"/>
|
|
||||||
<TextBox Grid.Column="3" Grid.Row="3" Text="{Binding TradeRequest.Sl}" Margin="5,0,0,0"/>
|
|
||||||
|
|
||||||
<TextBlock Grid.Column="0" Grid.Row="4" Text="Tp"/>
|
|
||||||
<TextBox Grid.Column="1" Grid.Row="4" Text="{Binding TradeRequest.Tp}" Margin="5,0,0,0"/>
|
|
||||||
|
|
||||||
<TextBlock Grid.Column="2" Grid.Row="4" Text="Deviation" Margin="10,0,0,0"/>
|
|
||||||
<TextBox Grid.Column="3" Grid.Row="4" Text="{Binding TradeRequest.Deviation}" Margin="5,0,0,0"/>
|
|
||||||
|
|
||||||
<TextBlock Grid.Column="0" Grid.Row="5" Text="Type"/>
|
|
||||||
<ComboBox Grid.Column="1" Grid.Row="5" ItemsSource="{Binding Source={StaticResource ENUM_ORDER_TYPE_Key}}"
|
|
||||||
SelectedItem="{Binding TradeRequest.Type}" Margin="5,0,0,0"/>
|
|
||||||
|
|
||||||
<TextBlock Grid.Column="2" Grid.Row="5" Text="Type_filling" Margin="10,0,0,0"/>
|
|
||||||
<ComboBox Grid.Column="3" Grid.Row="5" ItemsSource="{Binding Source={StaticResource ENUM_ORDER_TYPE_FILLING_Key}}"
|
|
||||||
SelectedItem="{Binding TradeRequest.Type_filling}" Margin="5,0,0,0"/>
|
|
||||||
|
|
||||||
<TextBlock Grid.Column="0" Grid.Row="6" Text="Type_time"/>
|
|
||||||
<ComboBox Grid.Column="1" Grid.Row="6" ItemsSource="{Binding Source={StaticResource ENUM_ORDER_TYPE_TIME_Key}}"
|
|
||||||
SelectedItem="{Binding TradeRequest.Type_time}" Margin="5,0,0,0"/>
|
|
||||||
|
|
||||||
<TextBlock Grid.Column="2" Grid.Row="6" Text="Expiration" Margin="10,0,0,0"/>
|
|
||||||
<TextBox Grid.Column="3" Grid.Row="6" Text="{Binding TradeRequest.Expiration}" Margin="5,0,0,0"/>
|
|
||||||
|
|
||||||
<TextBlock Grid.Column="0" Grid.Row="7" Text="Comment"/>
|
|
||||||
<TextBox Grid.Column="1" Grid.Row="7" Grid.ColumnSpan="3" Text="{Binding TradeRequest.Comment}" Margin="5,0,0,0"/>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Expander>
|
|
||||||
|
|
||||||
<StackPanel Grid.Row="1" Orientation="Vertical">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<Button Content="OrderSend" Command="{Binding OrderSendCommand}" Width="100" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
|
||||||
<Button Content="OrderCheck" Command="{Binding OrderCheckCommand}" Width="100" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
|
||||||
<Button Content="PositionGetTicket" Command="{Binding PositionGetTicketCommand}" Width="100" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<WrapPanel>
|
|
||||||
<Button Content="HistoryDealGetDouble" Command="{Binding HistoryDealGetDoubleCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
|
||||||
<Button Content="HistoryDealGetInteger" Command="{Binding HistoryDealGetIntegerCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
|
||||||
<Button Content="HistoryDealGetString" Command="{Binding HistoryDealGetStringCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
|
||||||
<Button Content="HistoryOrderGetInteger" Command="{Binding HistoryOrderGetIntegerCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
|
||||||
<Button Content="HistoryDealMethods" Command="{Binding HistoryDealMethodsCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
|
||||||
</WrapPanel>
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
</Grid>
|
|
||||||
</ScrollViewer>
|
|
||||||
</TabItem>
|
|
||||||
<TabItem Header="Account 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 AccountInfoDoublePropertyId}"
|
|
||||||
ItemsSource="{Binding Source={StaticResource ENUM_ACCOUNT_INFO_DOUBLE_Key}}"/>
|
|
||||||
<Button Grid.Column="1" Grid.Row="0" Margin="10,0,0,0"
|
|
||||||
Command="{Binding AccountInfoDoubleCommand}"
|
|
||||||
Content="AccountInfoDouble" HorizontalAlignment="Left" />
|
|
||||||
|
|
||||||
<ComboBox Grid.Column="0" Grid.Row="1"
|
|
||||||
SelectedItem="{Binding AccountInfoIntegerPropertyId}"
|
|
||||||
ItemsSource="{Binding Source={StaticResource ENUM_ACCOUNT_INFO_INTEGER_Key}}"/>
|
|
||||||
<Button Grid.Column="1" Grid.Row="1" Margin="10,0,0,0"
|
|
||||||
Command="{Binding AccountInfoIntegerCommand}"
|
|
||||||
Content="AccountInfoInteger" HorizontalAlignment="Left" />
|
|
||||||
|
|
||||||
<ComboBox Grid.Column="0" Grid.Row="2"
|
|
||||||
SelectedItem="{Binding AccountInfoStringPropertyId}"
|
|
||||||
ItemsSource="{Binding Source={StaticResource ENUM_ACCOUNT_INFO_STRING_Key}}"/>
|
|
||||||
<Button Grid.Column="1" Grid.Row="2" Margin="10,0,0,0"
|
|
||||||
Command="{Binding AccountInfoStringCommand}"
|
|
||||||
Content="AccountInfoString" HorizontalAlignment="Left" />
|
|
||||||
</Grid>
|
|
||||||
</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>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
|
|
||||||
<Grid Grid.Column="1" Margin="2">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
<Grid Grid.Row="0">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
<ColumnDefinition Width="*"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<TextBlock Grid.Row="0" Text="Symbol Name" Margin="1"/>
|
|
||||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="TimeFrame" Margin="1" HorizontalAlignment="Right"/>
|
|
||||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="StartPos" Margin="1" HorizontalAlignment="Right"/>
|
|
||||||
<TextBlock Grid.Row="3" Grid.Column="0" Text="Count" Margin="1" HorizontalAlignment="Right"/>
|
|
||||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding TimeSeriesValues.SymbolValue}" Margin="1"/>
|
|
||||||
<ComboBox Grid.Row="1" Grid.Column="1" Margin="1"
|
|
||||||
ItemsSource="{Binding Source={StaticResource ENUM_TIMEFRAMES_Key}}"
|
|
||||||
SelectedItem="{Binding TimeSeriesValues.TimeFrame}"/>
|
|
||||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding TimeSeriesValues.StartPos}" Margin="1"/>
|
|
||||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding TimeSeriesValues.Count}" Margin="1"/>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<WrapPanel Grid.Row="1" Grid.Column="0" Margin="5">
|
<ListBox Grid.Column="0" ItemsSource="{Binding TimeSeriesResults}" />
|
||||||
<Button Command="{Binding CopyRatesCommand}" Margin="1"
|
|
||||||
Content="CopyRates" HorizontalAlignment="Left" />
|
</Grid>
|
||||||
<Button Command="{Binding CopyTimesCommand}" Margin="1"
|
</TabItem>
|
||||||
Content="CopyTimes" HorizontalAlignment="Left" />
|
|
||||||
<Button Command="{Binding CopyOpenCommand}" Margin="1"
|
<TabItem Header="Market Info">
|
||||||
Content="CopyOpen" HorizontalAlignment="Left" />
|
<WrapPanel VerticalAlignment="Top" Margin="5">
|
||||||
<Button Command="{Binding CopyHighCommand}" Margin="1"
|
<Button Command="{Binding SymbolsTotalCommand}" Content="SymbolsTotal" Margin="2"/>
|
||||||
Content="CopyHigh" HorizontalAlignment="Left" />
|
<Button Command="{Binding SymbolNameCommand}" Content="SymbolName" Margin="2"/>
|
||||||
<Button Command="{Binding CopyLowCommand}" Margin="1"
|
<Button Command="{Binding SymbolSelectCommand}" Content="SymbolSelect" Margin="2"/>
|
||||||
Content="CopyLow" HorizontalAlignment="Left" />
|
<Button Command="{Binding SymbolIsSynchronizedCommand}" Content="SymbolIsSynchronized" Margin="2"/>
|
||||||
<Button Command="{Binding CopyCloseCommand}" Margin="1"
|
<Button Command="{Binding SymbolInfoDoubleCommand}" Content="SymbolInfoDouble" Margin="2"/>
|
||||||
Content="CopyClose" HorizontalAlignment="Left" />
|
<Button Command="{Binding SymbolInfoIntegerCommand}" Content="SymbolInfoInteger" Margin="2"/>
|
||||||
<Button Command="{Binding CopyTickVolumeCommand}" Margin="1"
|
<Button Command="{Binding SymbolInfoStringCommand}" Content="SymbolInfoString" Margin="2"/>
|
||||||
Content="CopyTickVolume" HorizontalAlignment="Left" />
|
<Button Command="{Binding SymbolInfoString2Command}" Content="SymbolInfoString-2" Margin="2"/>
|
||||||
<Button Command="{Binding CopyRealVolumeCommand}" Margin="1"
|
<Button Command="{Binding SymbolInfoTickCommand}" Content="SymbolInfoTick" Margin="2"/>
|
||||||
Content="CopyRealVolume" HorizontalAlignment="Left" />
|
<Button Command="{Binding SymbolInfoSessionQuoteCommand}" Content="SymbolInfoSessionQuote" Margin="2"/>
|
||||||
<Button Command="{Binding CopySpreadCommand}" Margin="1"
|
<Button Command="{Binding SymbolInfoSessionTradeCommand}" Content="SymbolInfoSessionTrade" Margin="2"/>
|
||||||
Content="CopySpread" HorizontalAlignment="Left" />
|
<Button Command="{Binding MarketBookAddCommand}" Content="MarketBookAdd" Margin="2"/>
|
||||||
<Button Command="{Binding CopyTicksCommand}" Margin="1"
|
<Button Command="{Binding MarketBookReleaseCommand}" Content="MarketBookRelease" Margin="2"/>
|
||||||
Content="CopyTicks" HorizontalAlignment="Left" />
|
<Button Command="{Binding MarketBookGetCommand}" Content="MarketBookGet" Margin="2"/>
|
||||||
|
</WrapPanel>
|
||||||
|
</TabItem>
|
||||||
|
|
||||||
|
<TabItem Header="CTrade">
|
||||||
|
<WrapPanel VerticalAlignment="Top" Margin="5">
|
||||||
|
<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>
|
||||||
|
<TabItem Header="Chart Functions">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="5">
|
||||||
|
<TextBlock Text="Symbol" VerticalAlignment="Center" Margin="2"/>
|
||||||
|
<TextBox Width="100" Text="{Binding ChartFunctionsSymbolValue}" Margin="2"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<WrapPanel Grid.Row="1" Orientation="Horizontal" Margin="5">
|
||||||
|
<Button Command="{Binding ChartOpenCommand}" Content="ChartOpen" Margin="2"/>
|
||||||
|
<Button Command="{Binding ChartTimePriceToXYCommand}" Content="ChartTimePriceToXY" Margin="2"/>
|
||||||
|
<Button Command="{Binding ChartXYToTimePriceCommand}" Content="ChartXYToTimePrice" Margin="2"/>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
|
|
||||||
<Grid Grid.Row="2">
|
<WrapPanel Grid.Row="2" VerticalAlignment="Top" Margin="5">
|
||||||
|
<Button Command="{Binding ChartApplyTemplateCommand}" Content="ChartApplyTemplate" Margin="2"/>
|
||||||
|
<Button Command="{Binding ChartSaveTemplateCommand}" Content="ChartSaveTemplate" Margin="2"/>
|
||||||
|
</WrapPanel>
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Header="Time and Date">
|
||||||
|
<WrapPanel VerticalAlignment="Top" Margin="5">
|
||||||
|
<Button Command="{Binding TimeCurrentCommand}" Content="TimeCurrent" Margin="2"/>
|
||||||
|
<Button Command="{Binding TimeTradeServerCommand}" Content="TimeTradeServer" Margin="2"/>
|
||||||
|
<Button Command="{Binding TimeLocalCommand}" Content="TimeLocal" Margin="2"/>
|
||||||
|
<Button Command="{Binding TimeGMTCommand}" Content="TimeGMT" Margin="2"/>
|
||||||
|
</WrapPanel>
|
||||||
|
</TabItem>
|
||||||
|
|
||||||
|
<TabItem Header="Checkup and Common Functions">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<WrapPanel VerticalAlignment="Top" Margin="5">
|
||||||
|
<Button Command="{Binding GetLastErrorCommand}" Content="GetLastError" Margin="2"/>
|
||||||
|
<Button Command="{Binding ResetLastErrorCommand}" Content="ResetLastError" Margin="2"/>
|
||||||
|
</WrapPanel>
|
||||||
|
|
||||||
|
<Grid Margin="10" Grid.Row="1">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<TextBox Grid.Row="0" Text="{Binding MessageText}" Margin="2"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
<ColumnDefinition Width="Auto"/>
|
<Button Command="{Binding PrintCommand}" Content="Print" Margin="2" />
|
||||||
</Grid.ColumnDefinitions>
|
<Button Command="{Binding AlertCommand}" Content="Alert" Margin="2" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<ComboBox Grid.Row="0" Grid.Column="0"
|
|
||||||
ItemsSource="{Binding Source={StaticResource ENUM_INDICATOR_Key}}"
|
|
||||||
SelectedItem="{Binding TimeSeriesValues.IndicatorType}"/>
|
|
||||||
<Button Grid.Row="0" Grid.Column="1" Command="{Binding IndicatorCreateCommand}" Margin="2"
|
|
||||||
Content="IndicatorCreate" HorizontalAlignment="Left" />
|
|
||||||
<Label Grid.Row="1" Grid.Column="0" Content="Indicator handle:" Margin="2"/>
|
|
||||||
<TextBox Grid.Row="1" Grid.Column="0" Margin="2" Width="30" PreviewTextInput="NumberValidationTextBox" Text="{Binding TimeSeriesValues.IndicatorHandle}"></TextBox>
|
|
||||||
<Button Grid.Row="1" Grid.Column="1" Command="{Binding IndicatorReleaseCommand}" Margin="2"
|
|
||||||
Content="IndicatorRelease" HorizontalAlignment="Left" />
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
|
</TabControl>
|
||||||
|
|
||||||
<ListBox Grid.Column="0" ItemsSource="{Binding TimeSeriesResults}" />
|
</Grid>
|
||||||
|
|
||||||
</Grid>
|
<GridSplitter Grid.Row="1" Height="2" HorizontalAlignment="Stretch" />
|
||||||
</TabItem>
|
|
||||||
|
|
||||||
<TabItem Header="Market Info">
|
<Border Grid.Row="2" BorderThickness="1" BorderBrush="DarkBlue" Margin="2">
|
||||||
<WrapPanel VerticalAlignment="Top" Margin="5">
|
<Grid Margin="3">
|
||||||
<Button Command="{Binding SymbolsTotalCommand}" Content="SymbolsTotal" Margin="2"/>
|
<Grid.RowDefinitions>
|
||||||
<Button Command="{Binding SymbolNameCommand}" Content="SymbolName" Margin="2"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<Button Command="{Binding SymbolSelectCommand}" Content="SymbolSelect" Margin="2"/>
|
<RowDefinition Height="*"/>
|
||||||
<Button Command="{Binding SymbolIsSynchronizedCommand}" Content="SymbolIsSynchronized" Margin="2"/>
|
</Grid.RowDefinitions>
|
||||||
<Button Command="{Binding SymbolInfoDoubleCommand}" Content="SymbolInfoDouble" Margin="2"/>
|
<Label Grid.Row="0" Content="Output Console" Background="LightYellow" />
|
||||||
<Button Command="{Binding SymbolInfoIntegerCommand}" Content="SymbolInfoInteger" Margin="2"/>
|
<ListBox Grid.Row="1" ItemsSource="{Binding History}"
|
||||||
<Button Command="{Binding SymbolInfoStringCommand}" Content="SymbolInfoString" Margin="2"/>
|
mtApi5TestClient:ListBoxBehavior.ScrollOnNewItem="true" />
|
||||||
<Button Command="{Binding SymbolInfoString2Command}" Content="SymbolInfoString-2" Margin="2"/>
|
</Grid>
|
||||||
<Button Command="{Binding SymbolInfoTickCommand}" Content="SymbolInfoTick" Margin="2"/>
|
</Border>
|
||||||
<Button Command="{Binding SymbolInfoSessionQuoteCommand}" Content="SymbolInfoSessionQuote" Margin="2"/>
|
|
||||||
<Button Command="{Binding SymbolInfoSessionTradeCommand}" Content="SymbolInfoSessionTrade" Margin="2"/>
|
|
||||||
<Button Command="{Binding MarketBookAddCommand}" Content="MarketBookAdd" Margin="2"/>
|
|
||||||
<Button Command="{Binding MarketBookReleaseCommand}" Content="MarketBookRelease" Margin="2"/>
|
|
||||||
<Button Command="{Binding MarketBookGetCommand}" Content="MarketBookGet" Margin="2"/>
|
|
||||||
</WrapPanel>
|
|
||||||
</TabItem>
|
|
||||||
|
|
||||||
<TabItem Header="CTrade">
|
|
||||||
<WrapPanel VerticalAlignment="Top" Margin="5">
|
|
||||||
<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>
|
|
||||||
<TabItem Header="Chart Functions">
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="5">
|
|
||||||
<TextBlock Text="Symbol" VerticalAlignment="Center" Margin="2"/>
|
|
||||||
<TextBox Width="100" Text="{Binding ChartFunctionsSymbolValue}" Margin="2"/>
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<WrapPanel Grid.Row="1" Orientation="Horizontal" Margin="5">
|
|
||||||
<Button Command="{Binding ChartOpenCommand}" Content="ChartOpen" Margin="2"/>
|
|
||||||
<Button Command="{Binding ChartTimePriceToXYCommand}" Content="ChartTimePriceToXY" Margin="2"/>
|
|
||||||
<Button Command="{Binding ChartXYToTimePriceCommand}" Content="ChartXYToTimePrice" Margin="2"/>
|
|
||||||
</WrapPanel>
|
|
||||||
|
|
||||||
<WrapPanel Grid.Row="2" VerticalAlignment="Top" Margin="5">
|
|
||||||
<Button Command="{Binding ChartApplyTemplateCommand}" Content="ChartApplyTemplate" Margin="2"/>
|
|
||||||
<Button Command="{Binding ChartSaveTemplateCommand}" Content="ChartSaveTemplate" Margin="2"/>
|
|
||||||
</WrapPanel>
|
|
||||||
</Grid>
|
|
||||||
</TabItem>
|
|
||||||
<TabItem Header="Time and Date">
|
|
||||||
<WrapPanel VerticalAlignment="Top" Margin="5">
|
|
||||||
<Button Command="{Binding TimeCurrentCommand}" Content="TimeCurrent" Margin="2"/>
|
|
||||||
<Button Command="{Binding TimeTradeServerCommand}" Content="TimeTradeServer" Margin="2"/>
|
|
||||||
<Button Command="{Binding TimeLocalCommand}" Content="TimeLocal" Margin="2"/>
|
|
||||||
<Button Command="{Binding TimeGMTCommand}" Content="TimeGMT" Margin="2"/>
|
|
||||||
</WrapPanel>
|
|
||||||
</TabItem>
|
|
||||||
|
|
||||||
<TabItem Header="Checkup and Common Functions">
|
|
||||||
<Grid>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="*" />
|
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
<WrapPanel VerticalAlignment="Top" Margin="5">
|
|
||||||
<Button Command="{Binding GetLastErrorCommand}" Content="GetLastError" Margin="2"/>
|
|
||||||
<Button Command="{Binding ResetLastErrorCommand}" Content="ResetLastError" Margin="2"/>
|
|
||||||
</WrapPanel>
|
|
||||||
|
|
||||||
<Grid Margin="10" Grid.Row="1">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
<RowDefinition Height="Auto"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<TextBox Grid.Row="0" Text="{Binding MessageText}" Margin="2"/>
|
|
||||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
|
||||||
<Button Command="{Binding PrintCommand}" Content="Print" Margin="2" />
|
|
||||||
<Button Command="{Binding AlertCommand}" Content="Alert" Margin="2" />
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</TabItem>
|
|
||||||
</TabControl>
|
|
||||||
|
|
||||||
<Expander Grid.Row="2" Header="Console" IsExpanded="True">
|
|
||||||
<ListBox mtApi5TestClient:ListBoxBehavior.ScrollOnNewItem="true" Height="180" ItemsSource="{Binding History}"/>
|
|
||||||
</Expander>
|
|
||||||
|
|
||||||
<StatusBar Grid.Row="3">
|
<StatusBar Grid.Row="3">
|
||||||
<StatusBarItem>
|
<StatusBarItem>
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
using System.ComponentModel;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.ComponentModel;
|
|
||||||
|
|
||||||
namespace MtApi5TestClient
|
namespace MtApi5TestClient
|
||||||
{
|
{
|
||||||
@@ -10,38 +6,38 @@ namespace MtApi5TestClient
|
|||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
public string Instrument { get; private set; }
|
public string Instrument { get; }
|
||||||
|
|
||||||
private double _Bid;
|
private double _bid;
|
||||||
public double Bid
|
public double Bid
|
||||||
{
|
{
|
||||||
get { return _Bid; }
|
get { return _bid; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_Bid = value;
|
_bid = value;
|
||||||
OnPropertyChanged("Bid");
|
OnPropertyChanged("Bid");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private double _Ask;
|
private double _ask;
|
||||||
public double Ask
|
public double Ask
|
||||||
{
|
{
|
||||||
get { return _Ask; }
|
get { return _ask; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_Ask = value;
|
_ask = value;
|
||||||
OnPropertyChanged("Ask");
|
OnPropertyChanged("Ask");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int _FeedCount = 0;
|
private int _expertHandle;
|
||||||
public int FeedCount
|
public int ExpertHandle
|
||||||
{
|
{
|
||||||
get { return _FeedCount; }
|
get { return _expertHandle; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_FeedCount = value;
|
_expertHandle = value;
|
||||||
OnPropertyChanged("FeedCount");
|
OnPropertyChanged("ExpertHandle");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,8 +55,7 @@ namespace MtApi5TestClient
|
|||||||
|
|
||||||
protected virtual void OnPropertyChanged(string propertyName)
|
protected virtual void OnPropertyChanged(string propertyName)
|
||||||
{
|
{
|
||||||
PropertyChangedEventHandler handler = PropertyChanged;
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,138 +87,6 @@ namespace MtApi5TestClient
|
|||||||
public DelegateCommand TimeGMTCommand { get; private set; }
|
public DelegateCommand TimeGMTCommand { get; private set; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Chart Commands
|
|
||||||
private async void ExecuteChartOpen(object o)
|
|
||||||
{
|
|
||||||
AddLog("Executed #1");
|
|
||||||
if (string.IsNullOrEmpty(ChartFunctionsSymbolValue))
|
|
||||||
{
|
|
||||||
AddLog("ChartOpen [ERROR]: Symbol is not defined!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddLog($"Executed #2 s:{ChartFunctionsSymbolValue}");
|
|
||||||
|
|
||||||
|
|
||||||
var result = await Execute(() =>
|
|
||||||
{
|
|
||||||
var SymbolAddReturn = _mtApiClient.SymbolSelect(ChartFunctionsSymbolValue, true);
|
|
||||||
var ChartId = _mtApiClient.ChartOpen(ChartFunctionsSymbolValue, TimeSeriesValues.TimeFrame);
|
|
||||||
return ChartId;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (result == -1)
|
|
||||||
{
|
|
||||||
AddLog("ChartOpen: result is null");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddLog($"ChartOpen: success chartid=>{result}");
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void ExecuteChartTimePriceToXY(object o)
|
|
||||||
{
|
|
||||||
const long chartId = 0;
|
|
||||||
const int subWindow = 0;
|
|
||||||
var time = DateTime.Now;
|
|
||||||
const double price = 1.131;
|
|
||||||
var x = 0;
|
|
||||||
var y = 0;
|
|
||||||
|
|
||||||
var result = await Execute(() => _mtApiClient.ChartTimePriceToXY(chartId, subWindow, time, price, out x, out y));
|
|
||||||
if (result == false)
|
|
||||||
{
|
|
||||||
AddLog("ChartTimePriceToXY: result is false");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddLog($"ChartTimePriceToXY: success. x = {x}; Y = {y}");
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void ExecuteChartXYToTimePrice(object o)
|
|
||||||
{
|
|
||||||
const long chartId = 0;
|
|
||||||
const int x = 0;
|
|
||||||
const int y = 0;
|
|
||||||
|
|
||||||
var subWindow = 0;
|
|
||||||
DateTime? time = null;
|
|
||||||
double price = double.NaN;
|
|
||||||
|
|
||||||
var result = await Execute(() => _mtApiClient.ChartXYToTimePrice(chartId, x, y, out subWindow, out time, out price));
|
|
||||||
if (result == false)
|
|
||||||
{
|
|
||||||
AddLog("ChartXYToTimePrice: result is false");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddLog($"ChartXYToTimePrice: success. subWindow = {subWindow}; time = {time}; price = {price}");
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void ExecuteChartApplyTemplate(object o)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(TimeSeriesValues?.SymbolValue)) return;
|
|
||||||
|
|
||||||
AddLog($"ExecuteChartApplyTemplate #2 s:{TimeSeriesValues?.SymbolValue}");
|
|
||||||
|
|
||||||
|
|
||||||
var result = await Execute(() =>
|
|
||||||
{
|
|
||||||
var SymbolAddReturn = _mtApiClient.SymbolSelect(TimeSeriesValues?.SymbolValue, true);
|
|
||||||
var ChartId = _mtApiClient.ChartOpen(TimeSeriesValues?.SymbolValue, TimeSeriesValues.TimeFrame);
|
|
||||||
|
|
||||||
var MT5Path = _mtApiClient.TerminalInfoString(ENUM_TERMINAL_INFO_STRING.TERMINAL_DATA_PATH);
|
|
||||||
|
|
||||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
|
||||||
openFileDialog.Filter = "Template File (*.tpl)|*.tpl|All files (*.*)|*.*";
|
|
||||||
if (openFileDialog.ShowDialog() == true)
|
|
||||||
{
|
|
||||||
var TemplateName = "\\Files\\mt5api_copy.tpl";
|
|
||||||
var TemplateStringContent = File.ReadAllLines(openFileDialog.FileName);
|
|
||||||
var DestPath = $"{MT5Path}\\MQL5{TemplateName}";
|
|
||||||
File.WriteAllLines($"{MT5Path}\\MQL5{TemplateName}", TemplateStringContent);
|
|
||||||
_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");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddLog($"ChartOpen: success chartid=>{result}");
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
private Mt5ConnectionState _connectionState;
|
private Mt5ConnectionState _connectionState;
|
||||||
public Mt5ConnectionState ConnectionState
|
public Mt5ConnectionState ConnectionState
|
||||||
@@ -339,11 +207,10 @@ namespace MtApi5TestClient
|
|||||||
_mtApiClient.QuoteAdded += mMtApiClient_QuoteAdded;
|
_mtApiClient.QuoteAdded += mMtApiClient_QuoteAdded;
|
||||||
_mtApiClient.QuoteRemoved += mMtApiClient_QuoteRemoved;
|
_mtApiClient.QuoteRemoved += mMtApiClient_QuoteRemoved;
|
||||||
_mtApiClient.QuoteUpdated += mMtApiClient_QuoteUpdated;
|
_mtApiClient.QuoteUpdated += mMtApiClient_QuoteUpdated;
|
||||||
|
_mtApiClient.QuoteUpdate += mMtApiClient_QuoteUpdate;
|
||||||
_mtApiClient.OnTradeTransaction += mMtApiClient_OnTradeTransaction;
|
_mtApiClient.OnTradeTransaction += mMtApiClient_OnTradeTransaction;
|
||||||
_mtApiClient.OnBookEvent += _mtApiClient_OnBookEvent;
|
_mtApiClient.OnBookEvent += _mtApiClient_OnBookEvent;
|
||||||
|
|
||||||
_quotesMap = new Dictionary<string, QuoteViewModel>();
|
|
||||||
|
|
||||||
ConnectionState = _mtApiClient.ConnectionState;
|
ConnectionState = _mtApiClient.ConnectionState;
|
||||||
ConnectionMessage = "Disconnected";
|
ConnectionMessage = "Disconnected";
|
||||||
Port = 8228; //default local port
|
Port = 8228; //default local port
|
||||||
@@ -1193,6 +1060,138 @@ namespace MtApi5TestClient
|
|||||||
AddLog($"TimeGMT: {retVal}");
|
AddLog($"TimeGMT: {retVal}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Chart Commands
|
||||||
|
private async void ExecuteChartOpen(object o)
|
||||||
|
{
|
||||||
|
AddLog("Executed #1");
|
||||||
|
if (string.IsNullOrEmpty(ChartFunctionsSymbolValue))
|
||||||
|
{
|
||||||
|
AddLog("ChartOpen [ERROR]: Symbol is not defined!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddLog($"Executed #2 s:{ChartFunctionsSymbolValue}");
|
||||||
|
|
||||||
|
|
||||||
|
var result = await Execute(() =>
|
||||||
|
{
|
||||||
|
var SymbolAddReturn = _mtApiClient.SymbolSelect(ChartFunctionsSymbolValue, true);
|
||||||
|
var ChartId = _mtApiClient.ChartOpen(ChartFunctionsSymbolValue, TimeSeriesValues.TimeFrame);
|
||||||
|
return ChartId;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (result == -1)
|
||||||
|
{
|
||||||
|
AddLog("ChartOpen: result is null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddLog($"ChartOpen: success chartid=>{result}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void ExecuteChartTimePriceToXY(object o)
|
||||||
|
{
|
||||||
|
const long chartId = 0;
|
||||||
|
const int subWindow = 0;
|
||||||
|
var time = DateTime.Now;
|
||||||
|
const double price = 1.131;
|
||||||
|
var x = 0;
|
||||||
|
var y = 0;
|
||||||
|
|
||||||
|
var result = await Execute(() => _mtApiClient.ChartTimePriceToXY(chartId, subWindow, time, price, out x, out y));
|
||||||
|
if (result == false)
|
||||||
|
{
|
||||||
|
AddLog("ChartTimePriceToXY: result is false");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddLog($"ChartTimePriceToXY: success. x = {x}; Y = {y}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void ExecuteChartXYToTimePrice(object o)
|
||||||
|
{
|
||||||
|
const long chartId = 0;
|
||||||
|
const int x = 0;
|
||||||
|
const int y = 0;
|
||||||
|
|
||||||
|
var subWindow = 0;
|
||||||
|
DateTime? time = null;
|
||||||
|
double price = double.NaN;
|
||||||
|
|
||||||
|
var result = await Execute(() => _mtApiClient.ChartXYToTimePrice(chartId, x, y, out subWindow, out time, out price));
|
||||||
|
if (result == false)
|
||||||
|
{
|
||||||
|
AddLog("ChartXYToTimePrice: result is false");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddLog($"ChartXYToTimePrice: success. subWindow = {subWindow}; time = {time}; price = {price}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void ExecuteChartApplyTemplate(object o)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(TimeSeriesValues?.SymbolValue)) return;
|
||||||
|
|
||||||
|
AddLog($"ExecuteChartApplyTemplate #2 s:{TimeSeriesValues?.SymbolValue}");
|
||||||
|
|
||||||
|
|
||||||
|
var result = await Execute(() =>
|
||||||
|
{
|
||||||
|
var SymbolAddReturn = _mtApiClient.SymbolSelect(TimeSeriesValues?.SymbolValue, true);
|
||||||
|
var ChartId = _mtApiClient.ChartOpen(TimeSeriesValues?.SymbolValue, TimeSeriesValues.TimeFrame);
|
||||||
|
|
||||||
|
var MT5Path = _mtApiClient.TerminalInfoString(ENUM_TERMINAL_INFO_STRING.TERMINAL_DATA_PATH);
|
||||||
|
|
||||||
|
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||||
|
openFileDialog.Filter = "Template File (*.tpl)|*.tpl|All files (*.*)|*.*";
|
||||||
|
if (openFileDialog.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
var TemplateName = "\\Files\\mt5api_copy.tpl";
|
||||||
|
var TemplateStringContent = File.ReadAllLines(openFileDialog.FileName);
|
||||||
|
var DestPath = $"{MT5Path}\\MQL5{TemplateName}";
|
||||||
|
File.WriteAllLines($"{MT5Path}\\MQL5{TemplateName}", TemplateStringContent);
|
||||||
|
_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");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddLog($"ChartOpen: success chartid=>{result}");
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
private static void RunOnUiThread(Action action)
|
private static void RunOnUiThread(Action action)
|
||||||
{
|
{
|
||||||
Application.Current?.Dispatcher.Invoke(action);
|
Application.Current?.Dispatcher.Invoke(action);
|
||||||
@@ -1203,27 +1202,29 @@ namespace MtApi5TestClient
|
|||||||
Application.Current?.Dispatcher.Invoke(action, args);
|
Application.Current?.Dispatcher.Invoke(action, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void mMtApiClient_QuoteUpdated(object sender, string symbol, double bid, double ask)
|
private static void mMtApiClient_QuoteUpdated(object sender, string symbol, double bid, double ask)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(symbol) == false)
|
Console.WriteLine(@"Quote: Symbol = {0}, Bid = {1}, Ask = {2}", symbol, bid, ask);
|
||||||
{
|
}
|
||||||
if (_quotesMap.ContainsKey(symbol))
|
|
||||||
{
|
|
||||||
var qvm = _quotesMap[symbol];
|
|
||||||
qvm.Bid = bid;
|
|
||||||
qvm.Ask = ask;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(symbol, TradeRequest.Symbol))
|
private void mMtApiClient_QuoteUpdate(object sender, Mt5QuoteEventArgs e)
|
||||||
|
{
|
||||||
|
if (_quotesMap.ContainsKey(e.Quote.ExpertHandle))
|
||||||
|
{
|
||||||
|
var qvm = _quotesMap[e.Quote.ExpertHandle];
|
||||||
|
qvm.Bid = e.Quote.Bid;
|
||||||
|
qvm.Ask = e.Quote.Ask;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.Equals(e.Quote.Instrument, TradeRequest.Symbol))
|
||||||
|
{
|
||||||
|
if (TradeRequest.Type == ENUM_ORDER_TYPE.ORDER_TYPE_BUY)
|
||||||
{
|
{
|
||||||
if (TradeRequest.Type == ENUM_ORDER_TYPE.ORDER_TYPE_BUY)
|
TradeRequest.Price = e.Quote.Ask;
|
||||||
{
|
}
|
||||||
TradeRequest.Price = ask;
|
else if (TradeRequest.Type == ENUM_ORDER_TYPE.ORDER_TYPE_SELL)
|
||||||
}
|
{
|
||||||
else if (TradeRequest.Type == ENUM_ORDER_TYPE.ORDER_TYPE_SELL)
|
TradeRequest.Price = e.Quote.Bid;
|
||||||
{
|
|
||||||
TradeRequest.Price = bid;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1269,42 +1270,34 @@ namespace MtApi5TestClient
|
|||||||
|
|
||||||
private void AddQuote(Mt5Quote quote)
|
private void AddQuote(Mt5Quote quote)
|
||||||
{
|
{
|
||||||
if (quote == null)
|
if (_quotesMap.ContainsKey(quote.ExpertHandle))
|
||||||
|
{
|
||||||
|
AddLog($"AddQuote: Quote {quote.Instrument} with handle {quote.ExpertHandle} is present list. Skipped!");
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QuoteViewModel qvm;
|
|
||||||
|
|
||||||
if (_quotesMap.ContainsKey(quote.Instrument) == false)
|
|
||||||
{
|
|
||||||
qvm = new QuoteViewModel(quote.Instrument);
|
|
||||||
_quotesMap[quote.Instrument] = qvm;
|
|
||||||
Quotes.Add(qvm);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qvm = _quotesMap[quote.Instrument];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qvm.FeedCount++;
|
var qvm = new QuoteViewModel(quote.Instrument)
|
||||||
qvm.Bid = quote.Bid;
|
{
|
||||||
qvm.Ask = quote.Ask;
|
ExpertHandle = quote.ExpertHandle,
|
||||||
|
Bid = quote.Bid,
|
||||||
|
Ask = quote.Ask
|
||||||
|
};
|
||||||
|
|
||||||
|
_quotesMap[quote.ExpertHandle] = qvm;
|
||||||
|
Quotes.Add(qvm);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveQuote(Mt5Quote quote)
|
private void RemoveQuote(Mt5Quote quote)
|
||||||
{
|
{
|
||||||
if (quote == null) return;
|
if (_quotesMap.ContainsKey(quote.ExpertHandle) == false)
|
||||||
|
|
||||||
if (_quotesMap.ContainsKey(quote.Instrument))
|
|
||||||
{
|
{
|
||||||
var qvm = _quotesMap[quote.Instrument];
|
AddLog($"RemoveQuote: Quote {quote.Instrument} with handle {quote.ExpertHandle} is NOT present list. Skipped!");
|
||||||
qvm.FeedCount--;
|
return;
|
||||||
|
|
||||||
if (qvm.FeedCount <= 0)
|
|
||||||
{
|
|
||||||
_quotesMap.Remove(quote.Instrument);
|
|
||||||
Quotes.Remove(qvm);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var qvm = _quotesMap[quote.ExpertHandle];
|
||||||
|
_quotesMap.Remove(quote.ExpertHandle);
|
||||||
|
Quotes.Remove(qvm);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnConnected()
|
private void OnConnected()
|
||||||
@@ -1378,7 +1371,7 @@ namespace MtApi5TestClient
|
|||||||
#region Private Fields
|
#region Private Fields
|
||||||
private readonly MtApi5Client _mtApiClient;
|
private readonly MtApi5Client _mtApiClient;
|
||||||
|
|
||||||
private readonly Dictionary<string, QuoteViewModel> _quotesMap;
|
private readonly Dictionary<int, QuoteViewModel> _quotesMap = new Dictionary<int, QuoteViewModel>();
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user