mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-08 08:27:50 +00:00
Added projects MtApi4 and MtApi5
This commit is contained in:
Executable
+8
@@ -0,0 +1,8 @@
|
||||
<Application x:Class="MtApi5TestClient.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
|
||||
namespace MtApi5TestClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace MtApi5TestClient
|
||||
{
|
||||
public class DelegateCommand : ICommand
|
||||
{
|
||||
private readonly Predicate<object> _canExecute;
|
||||
private readonly Action<object> _execute;
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
public DelegateCommand(Action<object> execute)
|
||||
: this(execute, null)
|
||||
{
|
||||
}
|
||||
|
||||
public DelegateCommand(Action<object> execute,
|
||||
Predicate<object> canExecute)
|
||||
{
|
||||
_execute = execute;
|
||||
_canExecute = canExecute;
|
||||
}
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
if (_canExecute == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return _canExecute(parameter);
|
||||
}
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
_execute(parameter);
|
||||
}
|
||||
|
||||
public void RaiseCanExecuteChanged()
|
||||
{
|
||||
if (CanExecuteChanged != null)
|
||||
{
|
||||
CanExecuteChanged(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+391
@@ -0,0 +1,391 @@
|
||||
<Window x:Class="MtApi5TestClient.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mtapi5="clr-namespace:MtApi5;assembly=MtApi5"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
Title="MainWindow" Height="700" Width="650"
|
||||
Closing="Window_Closing">
|
||||
<Window.Resources>
|
||||
<DataTemplate x:Key="ConnectionTextBlockTemplate" DataType="{x:Type mtapi5:Mt5ConnectionState}">
|
||||
<TextBlock Text="{Binding}" x:Name="PART_Text" />
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding}" Value="Connected">
|
||||
<Setter TargetName="PART_Text" Property="Text" Value="Connected" />
|
||||
<Setter TargetName="PART_Text" Property="Foreground" Value="Green" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding}" Value="Connecting">
|
||||
<Setter TargetName="PART_Text" Property="Text" Value="Connecting..." />
|
||||
<Setter TargetName="PART_Text" Property="Foreground" Value="Gold" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding}" Value="Failed">
|
||||
<Setter TargetName="PART_Text" Property="Text" Value="Connection Failed" />
|
||||
<Setter TargetName="PART_Text" Property="Foreground" Value="Red" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding}" Value="Disconnected">
|
||||
<Setter TargetName="PART_Text" Property="Text" Value="Disconnected" />
|
||||
<Setter TargetName="PART_Text" Property="Foreground" Value="Black" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_TRADE_REQUEST_ACTIONS_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_TRADE_REQUEST_ACTIONS"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_ORDER_TYPE_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_ORDER_TYPE"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_ORDER_TYPE_FILLING_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_ORDER_TYPE_FILLING"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_ORDER_TYPE_TIME_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_ORDER_TYPE_TIME"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_ACCOUNT_INFO_DOUBLE_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_ACCOUNT_INFO_DOUBLE"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_ACCOUNT_INFO_STRING_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_ACCOUNT_INFO_STRING"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_ACCOUNT_INFO_INTEGER_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_ACCOUNT_INFO_INTEGER"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_TIMEFRAMES_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_TIMEFRAMES"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
</Window.Resources>
|
||||
|
||||
<Grid x:Name="_MainLayout">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Expander ExpandDirection="Right" IsExpanded="True"
|
||||
Grid.Row="0" Grid.Column="0" Margin="5">
|
||||
<Expander.Header>
|
||||
<TextBlock Text="Connection" RenderTransformOrigin="0.5,0.5" Margin="0,0,0,0" Width="Auto">
|
||||
<TextBlock.LayoutTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleX="1" ScaleY="1"/>
|
||||
<SkewTransform AngleX="0" AngleY="0"/>
|
||||
<RotateTransform Angle="-90"/>
|
||||
<TranslateTransform X="0" Y="0"/>
|
||||
</TransformGroup>
|
||||
</TextBlock.LayoutTransform>
|
||||
<TextBlock.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleX="1" ScaleY="1"/>
|
||||
<SkewTransform AngleX="0" AngleY="0"/>
|
||||
<RotateTransform Angle="0"/>
|
||||
<TranslateTransform X="0" Y="0"/>
|
||||
</TransformGroup>
|
||||
</TextBlock.RenderTransform>
|
||||
</TextBlock>
|
||||
</Expander.Header>
|
||||
<Expander.Content>
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="150"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Host"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1"
|
||||
Margin="5,0,0,0"
|
||||
Text="{Binding Host, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Port"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1"
|
||||
Margin="5,0,0,0"
|
||||
Text="{Binding Port, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
|
||||
<StackPanel Grid.Row="2" Grid.ColumnSpan="2" Margin="5" Orientation="Horizontal">
|
||||
<Button Content="Connect" Width="70" Command="{Binding ConnectCommand}" />
|
||||
<Button Margin="5,0,0,0" Width="70" Content="Disconnect" Command="{Binding DisconnectCommand}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Expander.Content>
|
||||
</Expander>
|
||||
|
||||
<ListView Grid.Row="0" Grid.Column="1"
|
||||
ItemsSource="{Binding Quotes}"
|
||||
SelectedItem="{Binding SelectedQuote}"
|
||||
SelectionMode="Single">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Width="140" Header="Instrument" DisplayMemberBinding="{Binding Instrument}" />
|
||||
<GridViewColumn Width="80" Header="Bid" DisplayMemberBinding="{Binding Bid}" />
|
||||
<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" >
|
||||
<TabItem Header="Trade Functions">
|
||||
<ScrollViewer>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Expander Header="MqlTradeRequest" Margin="10">
|
||||
<Grid Margin="0,10,0,0">
|
||||
<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}" 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}" Margin="5,0,0,0"/>
|
||||
</Grid>
|
||||
</Expander>
|
||||
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||
<Button Content="OrderSend" Command="{Binding OrderSendCommand}" Width="100" Height="25"/>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
<TabItem Header="Account Information">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.4*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<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>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Timeseries and Indicators Access">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBox Grid.Row="0" Text="symbol_name"/>
|
||||
<TextBox Grid.Row="1" Text="timeframe"/>
|
||||
<TextBox Grid.Row="2" Text="start_pos"/>
|
||||
<TextBox Grid.Row="3" Text="count"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding TimeSeriesValues.SymbolValue}"/>
|
||||
<ComboBox Grid.Row="1" Grid.Column="1"
|
||||
ItemsSource="{Binding Source={StaticResource ENUM_TIMEFRAMES_Key}}"
|
||||
SelectedItem="{Binding TimeSeriesValues.TimeFrame}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding TimeSeriesValues.StartPos}"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding TimeSeriesValues.Count}"/>
|
||||
|
||||
<WrapPanel Grid.Row="4" Grid.ColumnSpan="2" Margin="10">
|
||||
<Button Command="{Binding CopyRatesCommand}"
|
||||
Content="CopyRates" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyTimesCommand}"
|
||||
Content="CopyTimes" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyOpenCommand}"
|
||||
Content="CopyOpen" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyHighCommand}"
|
||||
Content="CopyHigh" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyLowCommand}"
|
||||
Content="CopyLow" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyCloseCommand}"
|
||||
Content="CopyClose" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyTickVolumeCommand}"
|
||||
Content="CopyTickVolume" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyRealVolumeCommand}"
|
||||
Content="CopyRealVolume" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopySpreadCommand}"
|
||||
Content="CopySpread" HorizontalAlignment="Left" />
|
||||
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
|
||||
<ListBox ItemsSource="{Binding TimeSeriesResults}" />
|
||||
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header=" Market Info">
|
||||
<WrapPanel VerticalAlignment="Top" Margin="5">
|
||||
<Button Command="{Binding SymbolsTotalCommand}" Content="SymbolsTotal" Margin="2"/>
|
||||
<Button Command="{Binding SymbolNameCommand}" Content="SymbolName" Margin="2"/>
|
||||
<Button Command="{Binding SymbolSelectCommand}" Content="SymbolSelect" Margin="2"/>
|
||||
<Button Command="{Binding SymbolIsSynchronizedCommand}" Content="SymbolIsSynchronized" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoDoubleCommand}" Content="SymbolInfoDouble" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoIntegerCommand}" Content="SymbolInfoInteger" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoStringCommand}" Content="SymbolInfoString" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoTickCommand}" Content="SymbolInfoTick" Margin="2"/>
|
||||
<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>
|
||||
</TabControl>
|
||||
|
||||
<Expander Grid.Row="2" Header="History" IsExpanded="True">
|
||||
<ListBox Height="200" ItemsSource="{Binding History}"/>
|
||||
</Expander>
|
||||
|
||||
<StatusBar Grid.Row="3">
|
||||
<StatusBarItem>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="{Binding ConnectionState}"
|
||||
ToolTip="{Binding ConnectionMessage}"
|
||||
ContentTemplate="{StaticResource ConnectionTextBlockTemplate}"/>
|
||||
</StackPanel>
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
</Grid>
|
||||
</Window>
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace MtApi5TestClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
ViewModel _vm { get; set; }
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_vm = new ViewModel();
|
||||
_MainLayout.DataContext = _vm;
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
_vm.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+187
@@ -0,0 +1,187 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
using MtApi5;
|
||||
|
||||
namespace MtApi5TestClient
|
||||
{
|
||||
public class MqlTradeRequestViewModel : INotifyPropertyChanged
|
||||
{
|
||||
public MqlTradeRequestViewModel(MqlTradeRequest reqest)
|
||||
{
|
||||
if (reqest == null)
|
||||
throw new ArgumentNullException();
|
||||
|
||||
TradeRequest = reqest;
|
||||
}
|
||||
|
||||
private MqlTradeRequest TradeRequest { get; set; }
|
||||
|
||||
public ENUM_TRADE_REQUEST_ACTIONS Action
|
||||
{
|
||||
get { return TradeRequest.Action; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Action = value;
|
||||
OnPropertyChanged("Action");
|
||||
}
|
||||
}
|
||||
|
||||
public uint Magic
|
||||
{
|
||||
get { return TradeRequest.Magic; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Magic = value;
|
||||
OnPropertyChanged("Magic");
|
||||
}
|
||||
}
|
||||
|
||||
public uint Order
|
||||
{
|
||||
get { return TradeRequest.Order; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Order = value;
|
||||
OnPropertyChanged("Order");
|
||||
}
|
||||
}
|
||||
|
||||
public string Symbol
|
||||
{
|
||||
get { return TradeRequest.Symbol; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Symbol = value;
|
||||
OnPropertyChanged("Symbol");
|
||||
}
|
||||
}
|
||||
|
||||
public double Volume
|
||||
{
|
||||
get { return TradeRequest.Volume; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Volume = value;
|
||||
OnPropertyChanged("Volume");
|
||||
}
|
||||
}
|
||||
|
||||
public double Price
|
||||
{
|
||||
get { return TradeRequest.Price; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Price = value;
|
||||
OnPropertyChanged("Price");
|
||||
}
|
||||
}
|
||||
|
||||
public double Stoplimit
|
||||
{
|
||||
get { return TradeRequest.Stoplimit; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Stoplimit = value;
|
||||
OnPropertyChanged("Stoplimit");
|
||||
}
|
||||
}
|
||||
|
||||
public double Sl
|
||||
{
|
||||
get { return TradeRequest.Sl; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Sl = value;
|
||||
OnPropertyChanged("Sl");
|
||||
}
|
||||
}
|
||||
|
||||
public double Tp
|
||||
{
|
||||
get { return TradeRequest.Tp; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Tp = value;
|
||||
OnPropertyChanged("Tp");
|
||||
}
|
||||
}
|
||||
|
||||
public uint Deviation
|
||||
{
|
||||
get { return TradeRequest.Deviation; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Deviation = value;
|
||||
OnPropertyChanged("Deviation");
|
||||
}
|
||||
}
|
||||
|
||||
public ENUM_ORDER_TYPE Type
|
||||
{
|
||||
get { return TradeRequest.Type; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Type = value;
|
||||
OnPropertyChanged("Type");
|
||||
}
|
||||
}
|
||||
|
||||
public ENUM_ORDER_TYPE_FILLING Type_filling
|
||||
{
|
||||
get { return TradeRequest.Type_filling; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Type_filling = value;
|
||||
OnPropertyChanged("Type_filling");
|
||||
}
|
||||
}
|
||||
|
||||
public ENUM_ORDER_TYPE_TIME Type_time
|
||||
{
|
||||
get { return TradeRequest.Type_time; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Type_time = value;
|
||||
OnPropertyChanged("Type_time");
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime Expiration
|
||||
{
|
||||
get { return TradeRequest.Expiration; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Expiration = value;
|
||||
OnPropertyChanged("Expiration");
|
||||
}
|
||||
}
|
||||
|
||||
public string Comment
|
||||
{
|
||||
get { return TradeRequest.Comment; }
|
||||
set
|
||||
{
|
||||
TradeRequest.Comment = value;
|
||||
OnPropertyChanged("Comment");
|
||||
}
|
||||
}
|
||||
|
||||
public MqlTradeRequest GetMqlTradeRequest()
|
||||
{
|
||||
return TradeRequest;
|
||||
}
|
||||
|
||||
#region INotifyPropertyChanged
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChangedEventHandler handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Executable
+147
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{38B9C657-BC2F-44F0-8824-54B31F2A64F5}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MtApi5TestClient</RootNamespace>
|
||||
<AssemblyName>MtApi5TestClient</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<CodeAnalysisLogFile>bin\Debug\MtApi5TestClient.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<CodeAnalysisLogFile>bin\Release\MtApi5TestClient.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
|
||||
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
|
||||
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="DelegateCommand.cs" />
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MqlTradeRequestViewModel.cs" />
|
||||
<Compile Include="QuoteViewModel.cs" />
|
||||
<Compile Include="TimeSeriesValueViewModel.cs" />
|
||||
<Compile Include="ViewModel.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MtApi5\MtApi5.csproj">
|
||||
<Project>{AC8B5010-DA75-477E-9CA5-547C649E12D8}</Project>
|
||||
<Name>MtApi5</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("MtApi5TestClient")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("MtApi5TestClient")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//In order to begin building localizable applications, set
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US english
|
||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
//the line below to match the UICulture setting in the project file.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18034
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MtApi5TestClient.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MtApi5TestClient.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+117
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18034
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MtApi5TestClient.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
Executable
+67
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace MtApi5TestClient
|
||||
{
|
||||
public class QuoteViewModel: INotifyPropertyChanged
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public string Instrument { get; private set; }
|
||||
|
||||
private double _Bid;
|
||||
public double Bid
|
||||
{
|
||||
get { return _Bid; }
|
||||
set
|
||||
{
|
||||
_Bid = value;
|
||||
OnPropertyChanged("Bid");
|
||||
}
|
||||
}
|
||||
|
||||
private double _Ask;
|
||||
public double Ask
|
||||
{
|
||||
get { return _Ask; }
|
||||
set
|
||||
{
|
||||
_Ask = value;
|
||||
OnPropertyChanged("Ask");
|
||||
}
|
||||
}
|
||||
|
||||
private int _FeedCount = 0;
|
||||
public int FeedCount
|
||||
{
|
||||
get { return _FeedCount; }
|
||||
set
|
||||
{
|
||||
_FeedCount = value;
|
||||
OnPropertyChanged("FeedCount");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public QuoteViewModel(string instrument)
|
||||
{
|
||||
Instrument = instrument;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChangedEventHandler handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MtApi5;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace MtApi5TestClient
|
||||
{
|
||||
public class TimeSeriesValueViewModel : INotifyPropertyChanged
|
||||
{
|
||||
private string _SymbolValue;
|
||||
public string SymbolValue
|
||||
{
|
||||
get { return _SymbolValue; }
|
||||
set
|
||||
{
|
||||
_SymbolValue = value;
|
||||
OnPropertyChanged("SymbolValue");
|
||||
}
|
||||
}
|
||||
|
||||
public ENUM_TIMEFRAMES TimeFrame { get; set; }
|
||||
public int StartPos { get; set; }
|
||||
public int Count { get; set; }
|
||||
|
||||
#region INotifyPropertyChanged
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChangedEventHandler handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Executable
+765
@@ -0,0 +1,765 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using MtApi5;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace MtApi5TestClient
|
||||
{
|
||||
public class ViewModel : INotifyPropertyChanged
|
||||
{
|
||||
#region Commands
|
||||
public DelegateCommand ConnectCommand { get; private set; }
|
||||
public DelegateCommand DisconnectCommand { get; private set; }
|
||||
|
||||
public DelegateCommand OrderSendCommand { get; private set; }
|
||||
|
||||
public DelegateCommand AccountInfoDoubleCommand { get; private set; }
|
||||
public DelegateCommand AccountInfoIntegerCommand { get; private set; }
|
||||
public DelegateCommand AccountInfoStringCommand { get; private set; }
|
||||
|
||||
public DelegateCommand CopyRatesCommand { get; private set; }
|
||||
public DelegateCommand CopyTimesCommand { get; private set; }
|
||||
public DelegateCommand CopyOpenCommand { get; private set; }
|
||||
public DelegateCommand CopyHighCommand { get; private set; }
|
||||
public DelegateCommand CopyLowCommand { get; private set; }
|
||||
public DelegateCommand CopyCloseCommand { get; private set; }
|
||||
|
||||
public DelegateCommand CopyTickVolumeCommand { get; private set; }
|
||||
public DelegateCommand CopyRealVolumeCommand { get; private set; }
|
||||
public DelegateCommand CopySpreadCommand { get; private set; }
|
||||
|
||||
public DelegateCommand SymbolsTotalCommand { get; private set; }
|
||||
public DelegateCommand SymbolNameCommand { get; private set; }
|
||||
public DelegateCommand SymbolSelectCommand { get; private set; }
|
||||
public DelegateCommand SymbolIsSynchronizedCommand { get; private set; }
|
||||
public DelegateCommand SymbolInfoDoubleCommand { get; private set; }
|
||||
public DelegateCommand SymbolInfoIntegerCommand { get; private set; }
|
||||
public DelegateCommand SymbolInfoStringCommand { get; private set; }
|
||||
public DelegateCommand SymbolInfoTickCommand { get; private set; }
|
||||
public DelegateCommand SymbolInfoSessionQuoteCommand { get; private set; }
|
||||
public DelegateCommand SymbolInfoSessionTradeCommand { get; private set; }
|
||||
public DelegateCommand MarketBookAddCommand { get; private set; }
|
||||
public DelegateCommand MarketBookReleaseCommand { get; private set; }
|
||||
public DelegateCommand MarketBookGetCommand { get; private set; }
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
private Mt5ConnectionState _ConnectionState;
|
||||
public Mt5ConnectionState ConnectionState
|
||||
{
|
||||
get { return _ConnectionState; }
|
||||
set
|
||||
{
|
||||
_ConnectionState = value;
|
||||
OnPropertyChanged("ConnectionState");
|
||||
}
|
||||
}
|
||||
|
||||
private string _ConnectionMessage;
|
||||
public string ConnectionMessage
|
||||
{
|
||||
get { return _ConnectionMessage; }
|
||||
set
|
||||
{
|
||||
_ConnectionMessage = value;
|
||||
OnPropertyChanged("ConnectionMessage");
|
||||
}
|
||||
}
|
||||
|
||||
private string _Host;
|
||||
public string Host
|
||||
{
|
||||
get { return _Host; }
|
||||
set
|
||||
{
|
||||
_Host = value;
|
||||
OnPropertyChanged("Host");
|
||||
}
|
||||
}
|
||||
|
||||
private int _Port;
|
||||
public int Port
|
||||
{
|
||||
get { return _Port; }
|
||||
set
|
||||
{
|
||||
_Port = value;
|
||||
OnPropertyChanged("Port");
|
||||
}
|
||||
}
|
||||
|
||||
private ObservableCollection<QuoteViewModel> _Quotes = new ObservableCollection<QuoteViewModel>();
|
||||
public ObservableCollection<QuoteViewModel> Quotes
|
||||
{
|
||||
get { return _Quotes; }
|
||||
}
|
||||
|
||||
private QuoteViewModel _SelectedQuote;
|
||||
public QuoteViewModel SelectedQuote
|
||||
{
|
||||
get { return _SelectedQuote; }
|
||||
set
|
||||
{
|
||||
_SelectedQuote = value;
|
||||
OnPropertyChanged("SelectedQuote");
|
||||
OnSelectedQuoteChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private ObservableCollection<string> _History = new ObservableCollection<string>();
|
||||
public ObservableCollection<string> History
|
||||
{
|
||||
get { return _History; }
|
||||
}
|
||||
|
||||
private ObservableCollection<MqlTradeRequestViewModel> _TradeRequests = new ObservableCollection<MqlTradeRequestViewModel>();
|
||||
public ObservableCollection<MqlTradeRequestViewModel> TradeRequests
|
||||
{
|
||||
get { return _TradeRequests; }
|
||||
}
|
||||
|
||||
private MqlTradeRequestViewModel _TradeRequest;
|
||||
public MqlTradeRequestViewModel TradeRequest
|
||||
{
|
||||
get { return _TradeRequest; }
|
||||
set
|
||||
{
|
||||
_TradeRequest = value;
|
||||
OnPropertyChanged("TradeRequest");
|
||||
}
|
||||
}
|
||||
|
||||
public ENUM_ACCOUNT_INFO_DOUBLE AccountInfoDoublePropertyId { get; set; }
|
||||
public ENUM_ACCOUNT_INFO_INTEGER AccountInfoIntegerPropertyId { get; set; }
|
||||
public ENUM_ACCOUNT_INFO_STRING AccountInfoStringPropertyId { get; set; }
|
||||
|
||||
public TimeSeriesValueViewModel TimeSeriesValues { get; set; }
|
||||
|
||||
private ObservableCollection<string> _TimeSeriesResults = new ObservableCollection<string>();
|
||||
public ObservableCollection<string> TimeSeriesResults
|
||||
{
|
||||
get { return _TimeSeriesResults; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public ViewModel()
|
||||
{
|
||||
// Init MtApi client
|
||||
mMtApiClient = new MtApi5Client();
|
||||
|
||||
mMtApiClient.ConnectionStateChanged += new EventHandler<Mt5ConnectionEventArgs>(mMtApiClient_ConnectionStateChanged);
|
||||
mMtApiClient.QuoteAdded += new EventHandler<Mt5QuoteEventArgs>(mMtApiClient_QuoteAdded);
|
||||
mMtApiClient.QuoteRemoved += new EventHandler<Mt5QuoteEventArgs>(mMtApiClient_QuoteRemoved);
|
||||
mMtApiClient.QuoteUpdated += new MtApi5Client.QuoteHandler(mMtApiClient_QuoteUpdated);
|
||||
|
||||
_quotesMap = new Dictionary<string, QuoteViewModel>();
|
||||
|
||||
ConnectionState = mMtApiClient.ConnectionState;
|
||||
ConnectionMessage = "Disconnected";
|
||||
Port = 8228; //default local port
|
||||
|
||||
InitCommands();
|
||||
|
||||
var request = new MqlTradeRequest { Action = ENUM_TRADE_REQUEST_ACTIONS.TRADE_ACTION_DEAL
|
||||
, Type = ENUM_ORDER_TYPE.ORDER_TYPE_BUY
|
||||
, Volume = 0.1
|
||||
, Comment = "Test Trade Request"
|
||||
};
|
||||
|
||||
TradeRequest = new MqlTradeRequestViewModel(request);
|
||||
|
||||
TimeSeriesValues = new TimeSeriesValueViewModel();
|
||||
TimeSeriesValues.Count = 100;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
mMtApiClient.BeginDisconnect();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
|
||||
private void InitCommands()
|
||||
{
|
||||
ConnectCommand = new DelegateCommand(ExecuteConnect, CanExecuteConnect);
|
||||
DisconnectCommand = new DelegateCommand(ExecuteDisconnect, CanExecuteDisconnect);
|
||||
|
||||
OrderSendCommand = new DelegateCommand(ExecuteOrderSend);
|
||||
|
||||
AccountInfoDoubleCommand = new DelegateCommand(ExecuteAccountInfoDouble);
|
||||
AccountInfoIntegerCommand = new DelegateCommand(ExecuteAccountInfoInteger);
|
||||
AccountInfoStringCommand = new DelegateCommand(ExecuteAccountInfoString);
|
||||
|
||||
CopyRatesCommand = new DelegateCommand(ExecuteCopyRates);
|
||||
CopyTimesCommand = new DelegateCommand(ExecuteCopyTime);
|
||||
CopyOpenCommand = new DelegateCommand(ExecuteCopyOpen);
|
||||
CopyHighCommand = new DelegateCommand(ExecuteCopyHigh);
|
||||
CopyLowCommand = new DelegateCommand(ExecuteCopyLow);
|
||||
CopyCloseCommand = new DelegateCommand(ExecuteCopyClose);
|
||||
|
||||
CopyTickVolumeCommand = new DelegateCommand(ExecuteCopyTickVolume);
|
||||
CopyRealVolumeCommand = new DelegateCommand(ExecuteCopyRealVolume);
|
||||
CopySpreadCommand = new DelegateCommand(ExecuteCopySpread);
|
||||
|
||||
SymbolsTotalCommand = new DelegateCommand(ExecuteSymbolsTotal);
|
||||
SymbolNameCommand = new DelegateCommand(ExecuteSymbolName);
|
||||
SymbolSelectCommand = new DelegateCommand(ExecuteSymbolSelect);
|
||||
SymbolIsSynchronizedCommand = new DelegateCommand(ExecuteSymbolIsSynchronized);
|
||||
SymbolInfoDoubleCommand = new DelegateCommand(ExecuteSymbolInfoDouble);
|
||||
SymbolInfoIntegerCommand = new DelegateCommand(ExecuteSymbolInfoInteger);
|
||||
SymbolInfoStringCommand = new DelegateCommand(ExecuteSymbolInfoString);
|
||||
SymbolInfoTickCommand = new DelegateCommand(ExecuteSymbolInfoTick);
|
||||
SymbolInfoSessionQuoteCommand = new DelegateCommand(ExecuteSymbolInfoSessionQuote);
|
||||
SymbolInfoSessionTradeCommand = new DelegateCommand(ExecuteSymbolInfoSessionTrade);
|
||||
MarketBookAddCommand = new DelegateCommand(ExecuteMarketBookAdd);
|
||||
MarketBookReleaseCommand = new DelegateCommand(ExecuteMarketBookRelease);
|
||||
MarketBookGetCommand = new DelegateCommand(ExecuteMarketBookGet);
|
||||
}
|
||||
|
||||
private bool CanExecuteConnect(object o)
|
||||
{
|
||||
return ConnectionState == Mt5ConnectionState.Disconnected || ConnectionState == Mt5ConnectionState.Failed;
|
||||
}
|
||||
|
||||
private void ExecuteConnect(object o)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Host))
|
||||
{
|
||||
mMtApiClient.BeginConnect(Port);
|
||||
}
|
||||
else
|
||||
{
|
||||
mMtApiClient.BeginConnect(Host, Port);
|
||||
}
|
||||
}
|
||||
|
||||
private bool CanExecuteDisconnect(object o)
|
||||
{
|
||||
return ConnectionState == Mt5ConnectionState.Connected;
|
||||
}
|
||||
|
||||
private void ExecuteDisconnect(object o)
|
||||
{
|
||||
mMtApiClient.BeginDisconnect();
|
||||
}
|
||||
|
||||
private void ExecuteOrderSend(object o)
|
||||
{
|
||||
var request = TradeRequest.GetMqlTradeRequest();
|
||||
|
||||
MqlTradeResult result;
|
||||
bool retVal = mMtApiClient.OrderSend(request, out result);
|
||||
|
||||
string historyItem;
|
||||
|
||||
if (retVal == true)
|
||||
{
|
||||
historyItem = "OrderSend successed. " + MqlTradeResultToString(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
historyItem = "OrderSend failed. " + MqlTradeResultToString(result);
|
||||
}
|
||||
|
||||
History.Add(historyItem);
|
||||
}
|
||||
|
||||
private void ExecuteAccountInfoDouble(object o)
|
||||
{
|
||||
var result = mMtApiClient.AccountInfoDouble(AccountInfoDoublePropertyId);
|
||||
|
||||
var historyItem = string.Format("AccountInfoDouble: property_id = {0}; result = {1}", AccountInfoDoublePropertyId, result);
|
||||
History.Add(historyItem);
|
||||
}
|
||||
|
||||
private void ExecuteAccountInfoInteger(object o)
|
||||
{
|
||||
var result = mMtApiClient.AccountInfoInteger(AccountInfoIntegerPropertyId);
|
||||
|
||||
var historyItem = string.Format("AccountInfoInteger: property_id = {0}; result = {1}", AccountInfoDoublePropertyId, result);
|
||||
History.Add(historyItem);
|
||||
}
|
||||
|
||||
private void ExecuteAccountInfoString(object o)
|
||||
{
|
||||
var result = mMtApiClient.AccountInfoString(AccountInfoStringPropertyId);
|
||||
|
||||
var historyItem = string.Format("AccountInfoString: property_id = {0}; result = {1}", AccountInfoDoublePropertyId, result);
|
||||
History.Add(historyItem);
|
||||
}
|
||||
|
||||
private void ExecuteCopyTime(object o)
|
||||
{
|
||||
if (TimeSeriesValues != null && string.IsNullOrEmpty(TimeSeriesValues.SymbolValue) == false)
|
||||
{
|
||||
TimeSeriesResults.Clear();
|
||||
|
||||
DateTime[] timesArray;
|
||||
var count = mMtApiClient.CopyTime(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, TimeSeriesValues.StartPos, TimeSeriesValues.Count, out timesArray);
|
||||
if (count > 0)
|
||||
{
|
||||
foreach (var time in timesArray)
|
||||
{
|
||||
TimeSeriesResults.Add(time.ToString());
|
||||
}
|
||||
|
||||
History.Add("CopyTime success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteCopyOpen(object o)
|
||||
{
|
||||
if (TimeSeriesValues != null && string.IsNullOrEmpty(TimeSeriesValues.SymbolValue) == false)
|
||||
{
|
||||
TimeSeriesResults.Clear();
|
||||
|
||||
double[] opensArray;
|
||||
var count = mMtApiClient.CopyOpen(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, TimeSeriesValues.StartPos, TimeSeriesValues.Count, out opensArray);
|
||||
if (count > 0)
|
||||
{
|
||||
foreach (var open in opensArray)
|
||||
{
|
||||
TimeSeriesResults.Add(open.ToString());
|
||||
}
|
||||
|
||||
History.Add("CopyOpen success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteCopyHigh(object o)
|
||||
{
|
||||
if (TimeSeriesValues != null && string.IsNullOrEmpty(TimeSeriesValues.SymbolValue) == false)
|
||||
{
|
||||
TimeSeriesResults.Clear();
|
||||
|
||||
double[] array;
|
||||
var count = mMtApiClient.CopyHigh(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, TimeSeriesValues.StartPos, TimeSeriesValues.Count, out array);
|
||||
if (count > 0)
|
||||
{
|
||||
foreach (var value in array)
|
||||
{
|
||||
TimeSeriesResults.Add(value.ToString());
|
||||
}
|
||||
|
||||
History.Add("CopyHigh success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteCopyLow(object o)
|
||||
{
|
||||
if (TimeSeriesValues != null && string.IsNullOrEmpty(TimeSeriesValues.SymbolValue) == false)
|
||||
{
|
||||
TimeSeriesResults.Clear();
|
||||
|
||||
double[] array;
|
||||
var count = mMtApiClient.CopyLow(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, TimeSeriesValues.StartPos, TimeSeriesValues.Count, out array);
|
||||
if (count > 0)
|
||||
{
|
||||
foreach (var value in array)
|
||||
{
|
||||
TimeSeriesResults.Add(value.ToString());
|
||||
}
|
||||
|
||||
History.Add("CopyLow success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteCopyClose(object o)
|
||||
{
|
||||
if (TimeSeriesValues != null && string.IsNullOrEmpty(TimeSeriesValues.SymbolValue) == false)
|
||||
{
|
||||
TimeSeriesResults.Clear();
|
||||
|
||||
double[] array;
|
||||
var count = mMtApiClient.CopyClose(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, TimeSeriesValues.StartPos, TimeSeriesValues.Count, out array);
|
||||
if (count > 0)
|
||||
{
|
||||
foreach (var value in array)
|
||||
{
|
||||
TimeSeriesResults.Add(value.ToString());
|
||||
}
|
||||
|
||||
History.Add("CopyClose success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteCopyRates(object o)
|
||||
{
|
||||
if (TimeSeriesValues != null && string.IsNullOrEmpty(TimeSeriesValues.SymbolValue) == false)
|
||||
{
|
||||
TimeSeriesResults.Clear();
|
||||
|
||||
MqlRates[] ratesArray;
|
||||
var count = mMtApiClient.CopyRates(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, TimeSeriesValues.StartPos, TimeSeriesValues.Count, out ratesArray);
|
||||
if (count > 0)
|
||||
{
|
||||
foreach (var rates in ratesArray)
|
||||
{
|
||||
TimeSeriesResults.Add(string.Format("time={0}; open={1}; high={2}; low={3}; close={4}; tick_volume={5}; spread={6}; real_volume={7}",
|
||||
rates.time, rates.open, rates.high, rates.low, rates.close, rates.tick_volume, rates.spread, rates.tick_volume));
|
||||
}
|
||||
|
||||
History.Add("CopyRates success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteCopyTickVolume(object o)
|
||||
{
|
||||
if (TimeSeriesValues != null && string.IsNullOrEmpty(TimeSeriesValues.SymbolValue) == false)
|
||||
{
|
||||
TimeSeriesResults.Clear();
|
||||
|
||||
long[] array;
|
||||
var count = mMtApiClient.CopyTickVolume(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, TimeSeriesValues.StartPos, TimeSeriesValues.Count, out array);
|
||||
if (count > 0)
|
||||
{
|
||||
foreach (var value in array)
|
||||
{
|
||||
TimeSeriesResults.Add(value.ToString());
|
||||
}
|
||||
|
||||
History.Add("CopyTickVolume success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteCopyRealVolume(object o)
|
||||
{
|
||||
if (TimeSeriesValues != null && string.IsNullOrEmpty(TimeSeriesValues.SymbolValue) == false)
|
||||
{
|
||||
TimeSeriesResults.Clear();
|
||||
|
||||
long[] array;
|
||||
var count = mMtApiClient.CopyRealVolume(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, TimeSeriesValues.StartPos, TimeSeriesValues.Count, out array);
|
||||
if (count > 0)
|
||||
{
|
||||
foreach (var value in array)
|
||||
{
|
||||
TimeSeriesResults.Add(value.ToString());
|
||||
}
|
||||
|
||||
History.Add("CopyRealVolume success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteCopySpread(object o)
|
||||
{
|
||||
if (TimeSeriesValues != null && string.IsNullOrEmpty(TimeSeriesValues.SymbolValue) == false)
|
||||
{
|
||||
TimeSeriesResults.Clear();
|
||||
|
||||
int[] array;
|
||||
var count = mMtApiClient.CopySpread(TimeSeriesValues.SymbolValue, TimeSeriesValues.TimeFrame, TimeSeriesValues.StartPos, TimeSeriesValues.Count, out array);
|
||||
if (count > 0)
|
||||
{
|
||||
foreach (var value in array)
|
||||
{
|
||||
TimeSeriesResults.Add(value.ToString());
|
||||
}
|
||||
|
||||
History.Add("CopySpread success");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteSymbolsTotal(object o)
|
||||
{
|
||||
var selectedCount = mMtApiClient.SymbolsTotal(true);
|
||||
History.Add("SymbolsTotal(true) success, result = " + selectedCount.ToString());
|
||||
|
||||
var commonCount = mMtApiClient.SymbolsTotal(false);
|
||||
History.Add("SymbolsTotal(false) success, result = " + selectedCount.ToString());
|
||||
}
|
||||
|
||||
private void ExecuteSymbolName(object o)
|
||||
{
|
||||
var selectedSymbol = mMtApiClient.SymbolName(5, true);
|
||||
History.Add("SymbolName(5, true) success, result = " + selectedSymbol);
|
||||
|
||||
var commonSymbol = mMtApiClient.SymbolName(5, false);
|
||||
History.Add("SymbolName(5, false) success, result = " + commonSymbol);
|
||||
|
||||
}
|
||||
|
||||
private void ExecuteSymbolSelect(object o)
|
||||
{
|
||||
var retVal = mMtApiClient.SymbolSelect("AUDJPY", true);
|
||||
History.Add("SymbolSelect(AUDJPY, true) success, result = " + retVal);
|
||||
|
||||
//var retVal1 = mMtApiClient.SymbolSelect("AUDJPY", false);
|
||||
//History.Add("SymbolSelect(AUDJPY, false) success, result = " + retVal1);
|
||||
}
|
||||
|
||||
private void ExecuteSymbolIsSynchronized(object o)
|
||||
{
|
||||
var retVal = mMtApiClient.SymbolIsSynchronized("EURUSD");
|
||||
History.Add("SymbolIsSynchronized(EURUSD) success, result = " + retVal);
|
||||
}
|
||||
|
||||
private void ExecuteSymbolInfoDouble(object o)
|
||||
{
|
||||
var retVal = mMtApiClient.SymbolInfoDouble("EURUSD", ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_BID);
|
||||
History.Add("SymbolInfoDouble(EURUSD, ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_BID) success, result = " + retVal);
|
||||
}
|
||||
|
||||
private void ExecuteSymbolInfoInteger(object o)
|
||||
{
|
||||
var retVal = mMtApiClient.SymbolInfoInteger("EURUSD", ENUM_SYMBOL_INFO_INTEGER.SYMBOL_SPREAD);
|
||||
History.Add("SymbolInfoInteger(EURUSD, ENUM_SYMBOL_INFO_INTEGER.SYMBOL_SPREAD) success, result = " + retVal);
|
||||
}
|
||||
|
||||
private void ExecuteSymbolInfoString(object o)
|
||||
{
|
||||
var retVal = mMtApiClient.SymbolInfoString("EURUSD", ENUM_SYMBOL_INFO_STRING.SYMBOL_DESCRIPTION);
|
||||
History.Add("SymbolInfoString(EURUSD, ENUM_SYMBOL_INFO_STRING.SYMBOL_DESCRIPTION) success, result = " + retVal);
|
||||
}
|
||||
|
||||
private void ExecuteSymbolInfoTick(object o)
|
||||
{
|
||||
MqlTick tick;
|
||||
var retVal = mMtApiClient.SymbolInfoTick("EURUSD", out tick);
|
||||
History.Add("SymbolInfoTick(EURUSD) success, result = " + retVal);
|
||||
History.Add("SymbolInfoTick(EURUSD) tick.time = " + tick.time);
|
||||
History.Add("SymbolInfoTick(EURUSD) tick.bid = " + tick.bid);
|
||||
History.Add("SymbolInfoTick(EURUSD) tick.ask = " + tick.ask);
|
||||
History.Add("SymbolInfoTick(EURUSD) tick.last = " + tick.last);
|
||||
History.Add("SymbolInfoTick(EURUSD) tick.volume = " + tick.volume);
|
||||
}
|
||||
|
||||
private void ExecuteSymbolInfoSessionQuote(object o)
|
||||
{
|
||||
DateTime from;
|
||||
DateTime to;
|
||||
var retVal = mMtApiClient.SymbolInfoSessionQuote("EURUSD", ENUM_DAY_OF_WEEK.MONDAY, 0, out from, out to);
|
||||
History.Add("SymbolInfoSessionQuote(EURUSD) success, result = " + retVal);
|
||||
History.Add("SymbolInfoSessionQuote(EURUSD) from = " + from);
|
||||
History.Add("SymbolInfoSessionQuote(EURUSD) to = " + to);
|
||||
}
|
||||
|
||||
private void ExecuteSymbolInfoSessionTrade(object o)
|
||||
{
|
||||
DateTime from;
|
||||
DateTime to;
|
||||
var retVal = mMtApiClient.SymbolInfoSessionTrade("EURUSD", ENUM_DAY_OF_WEEK.MONDAY, 0, out from, out to);
|
||||
History.Add("SymbolInfoSessionTrade(EURUSD) success, result = " + retVal);
|
||||
History.Add("SymbolInfoSessionTrade(EURUSD) from = " + from);
|
||||
History.Add("SymbolInfoSessionTrade(EURUSD) to = " + to);
|
||||
}
|
||||
|
||||
private void ExecuteMarketBookAdd(object o)
|
||||
{
|
||||
var retVal = mMtApiClient.MarketBookAdd("CHFJPY");
|
||||
History.Add("MarketBookAdd(CHFJPY) success, result = " + retVal);
|
||||
}
|
||||
|
||||
private void ExecuteMarketBookRelease(object o)
|
||||
{
|
||||
var retVal = mMtApiClient.MarketBookRelease("CHFJPY");
|
||||
History.Add("MarketBookRelease(CHFJPY) success, result = " + retVal);
|
||||
}
|
||||
|
||||
private void ExecuteMarketBookGet(object o)
|
||||
{
|
||||
MqlBookInfo[] book;
|
||||
var retVal = mMtApiClient.MarketBookGet("EURUSD", out book);
|
||||
History.Add("MarketBookGet(EURUSD) success, result = " + retVal);
|
||||
if (retVal == true && book != null)
|
||||
{
|
||||
for (int i = 0; i < book.Length; i++)
|
||||
{
|
||||
History.Add(String.Format("MarketBookGet: book[{0}].price = {1}", i, book[i].price));
|
||||
History.Add(String.Format("MarketBookGet: book[{0}].price = {1}", i, book[i].volume));
|
||||
History.Add(String.Format("MarketBookGet: book[{0}].price = {1}", i, book[i].type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void runOnUIThread(Action action)
|
||||
{
|
||||
if (Application.Current != null)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(action);
|
||||
}
|
||||
}
|
||||
|
||||
private void runOnUIThread<T>(Action<T> action, params Object[] args)
|
||||
{
|
||||
if (Application.Current != null)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(action, args);
|
||||
}
|
||||
}
|
||||
|
||||
private object mLocker = new object();
|
||||
|
||||
private void mMtApiClient_QuoteUpdated(object sender, string symbol, double bid, double ask)
|
||||
{
|
||||
if (string.IsNullOrEmpty(symbol) == false)
|
||||
{
|
||||
if (_quotesMap.ContainsKey(symbol) == true)
|
||||
{
|
||||
var qvm = _quotesMap[symbol];
|
||||
qvm.Bid = bid;
|
||||
qvm.Ask = ask;
|
||||
}
|
||||
|
||||
if (string.Equals(symbol, TradeRequest.Symbol))
|
||||
{
|
||||
if (TradeRequest.Type == ENUM_ORDER_TYPE.ORDER_TYPE_BUY)
|
||||
{
|
||||
TradeRequest.Price = ask;
|
||||
}
|
||||
else if (TradeRequest.Type == ENUM_ORDER_TYPE.ORDER_TYPE_SELL)
|
||||
{
|
||||
TradeRequest.Price = bid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void mMtApiClient_QuoteRemoved(object sender, Mt5QuoteEventArgs e)
|
||||
{
|
||||
runOnUIThread<Mt5Quote>(RemoveQuote, e.Quote);
|
||||
}
|
||||
|
||||
private void mMtApiClient_QuoteAdded(object sender, Mt5QuoteEventArgs e)
|
||||
{
|
||||
runOnUIThread<Mt5Quote>(AddQuote, e.Quote);
|
||||
}
|
||||
|
||||
private void mMtApiClient_ConnectionStateChanged(object sender, Mt5ConnectionEventArgs e)
|
||||
{
|
||||
ConnectionState = e.Status;
|
||||
ConnectionMessage = e.ConnectionMessage;
|
||||
|
||||
runOnUIThread(ConnectCommand.RaiseCanExecuteChanged);
|
||||
runOnUIThread(DisconnectCommand.RaiseCanExecuteChanged);
|
||||
|
||||
switch (e.Status)
|
||||
{
|
||||
case Mt5ConnectionState.Connected:
|
||||
runOnUIThread(OnConnected);
|
||||
break;
|
||||
case Mt5ConnectionState.Disconnected:
|
||||
runOnUIThread(OnDisconnected);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void AddQuote(Mt5Quote quote)
|
||||
{
|
||||
if (quote == null)
|
||||
return;
|
||||
|
||||
QuoteViewModel qvm = null;
|
||||
|
||||
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++;
|
||||
qvm.Bid = quote.Bid;
|
||||
qvm.Ask = quote.Ask;
|
||||
}
|
||||
|
||||
private void RemoveQuote(Mt5Quote quote)
|
||||
{
|
||||
if (quote == null)
|
||||
return;
|
||||
|
||||
if (_quotesMap.ContainsKey(quote.Instrument) == true)
|
||||
{
|
||||
var qvm = _quotesMap[quote.Instrument];
|
||||
qvm.FeedCount--;
|
||||
|
||||
if (qvm.FeedCount <= 0)
|
||||
{
|
||||
_quotesMap.Remove(quote.Instrument);
|
||||
Quotes.Remove(qvm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnConnected()
|
||||
{
|
||||
var quotes = mMtApiClient.GetQuotes();
|
||||
if (quotes != null)
|
||||
{
|
||||
foreach (var quote in quotes)
|
||||
{
|
||||
AddQuote(quote);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisconnected()
|
||||
{
|
||||
_quotesMap.Clear();
|
||||
Quotes.Clear();
|
||||
}
|
||||
|
||||
private static string MqlTradeResultToString(MqlTradeResult result)
|
||||
{
|
||||
return result != null ?
|
||||
"Retcode = " + result.Retcode + ";"
|
||||
+ " Comment = " + result.Comment + ";"
|
||||
+ " Order = " + result.Order + ";"
|
||||
+ " Volume = " + result.Volume + ";"
|
||||
+ " Price = " + result.Price + ";"
|
||||
+ " Deal = " + result.Deal + ";"
|
||||
+ " Request_id = " + result.Request_id + ";"
|
||||
+ " Bid = " + result.Bid + ";"
|
||||
+ " Ask = " + result.Ask + ";" : string.Empty;
|
||||
}
|
||||
|
||||
private void OnSelectedQuoteChanged()
|
||||
{
|
||||
if (SelectedQuote != null)
|
||||
{
|
||||
TradeRequest.Symbol = SelectedQuote.Instrument;
|
||||
TimeSeriesValues.SymbolValue = SelectedQuote.Instrument;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChangedEventHandler handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Fields
|
||||
private readonly MtApi5Client mMtApiClient;
|
||||
|
||||
private Dictionary<string, QuoteViewModel> _quotesMap;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user