Exemplo n.º 1
0
        private void buttonConnect_Click(object sender, EventArgs e)
        {
            var serverName = textBoxServerName.Text;

            int port;

            int.TryParse(textBoxPort.Text, out port);

            _timerTradeMonitor.Start();
            _timeframeTradeMonitor.Start();

            if (string.IsNullOrEmpty(serverName))
            {
                _apiClient.BeginConnect(port);
            }
            else
            {
                _apiClient.BeginConnect(serverName, port);
            }
        }
Exemplo n.º 2
0
        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);
        }