コード例 #1
0
ファイル: Form1.cs プロジェクト: dejota2k1/mtapi
        public Form1()
        {
            InitializeComponent();

            comboBox3.DataSource  = Enum.GetNames(typeof(ENUM_TIMEFRAMES));
            comboBox6.DataSource  = Enum.GetNames(typeof(ENUM_TIMEFRAMES));
            comboBox7.DataSource  = Enum.GetNames(typeof(EnumSymbolInfoDouble));
            comboBox8.DataSource  = Enum.GetNames(typeof(MarketInfoModeType));
            comboBox9.DataSource  = Enum.GetNames(typeof(EnumTerminalInfoInteger));
            comboBox10.DataSource = Enum.GetNames(typeof(EnumTerminalInfoDouble));

            _apiClient.QuoteUpdated           += apiClient_QuoteUpdated;
            _apiClient.QuoteAdded             += apiClient_QuoteAdded;
            _apiClient.QuoteRemoved           += apiClient_QuoteRemoved;
            _apiClient.ConnectionStateChanged += apiClient_ConnectionStateChanged;
            _apiClient.OnLastTimeBar          += _apiClient_OnLastTimeBar;

            InitOrderCommandsGroup();

            comboBox1.SelectedIndex = 0;
            comboBox2.SelectedIndex = 0;
            comboBox3.SelectedIndex = 0;
            comboBox4.SelectedIndex = 0;
            comboBox5.SelectedIndex = 0;

            _timerTradeMonitor = new TimerTradeMonitor(_apiClient)
            {
                Interval = 10000
            };                                                                           // 10 sec
            _timerTradeMonitor.AvailabilityOrdersChanged += _tradeMonitor_AvailabilityOrdersChanged;

            _timeframeTradeMonitor = new TimeframeTradeMonitor(_apiClient);
            _timeframeTradeMonitor.AvailabilityOrdersChanged += _tradeMonitor_AvailabilityOrdersChanged;
        }
コード例 #2
0
        /// <summary>
        /// MT4Controller
        /// </summary>
        public MT4Controller()
        {
            _apiClient.QuoteUpdated           += apiClient_QuoteUpdated;
            _apiClient.QuoteUpdate            += _apiClient_QuoteUpdate;
            _apiClient.QuoteAdded             += apiClient_QuoteAdded;
            _apiClient.QuoteRemoved           += apiClient_QuoteRemoved;
            _apiClient.ConnectionStateChanged += apiClient_ConnectionStateChanged;
            _apiClient.OnLastTimeBar          += _apiClient_OnLastTimeBar;
            _apiClient.OnChartEvent           += _apiClient_OnChartEvent;

            _timerTradeMonitor = new TimerTradeMonitor(_apiClient)
            {
                Interval = 10000
            };                                                                           // 10 sec
            _timerTradeMonitor.AvailabilityOrdersChanged += _tradeMonitor_AvailabilityOrdersChanged;

            _timeframeTradeMonitor = new TimeframeTradeMonitor(_apiClient);
            _timeframeTradeMonitor.AvailabilityOrdersChanged += _tradeMonitor_AvailabilityOrdersChanged;
        }
コード例 #3
0
ファイル: MT4APICharts.cs プロジェクト: sv-dev2/ELEVEN
        private MT4APICharts()
        {
            apiClient = new MtApiClient();
            // apiClient.QuoteUpdated += ApiClient_QuoteUpdated;
            apiClient.QuoteUpdate            += ApiClient_QuoteUpdate;
            apiClient.ConnectionStateChanged += ApiClient_ConnectionStateChanged;

            _timerTradeMonitor = new TimerTradeMonitor(apiClient)
            {
                Interval = 10000
            };                                                                          // 10 sec
            _timerTradeMonitor.AvailabilityOrdersChanged += _tradeMonitor_AvailabilityOrdersChanged;

            _timeframeTradeMonitor = new TimeframeTradeMonitor(apiClient);
            _timeframeTradeMonitor.AvailabilityOrdersChanged += _tradeMonitor_AvailabilityOrdersChanged;

            apiClient.OnLastTimeBar += apiClient_OnLastTimeBar;
            //Connect to MT
            _timerTradeMonitor.Start();
            _timeframeTradeMonitor.Start();
            apiClient.BeginConnect(8222);
        }