예제 #1
0
파일: Program.cs 프로젝트: zhao0876/mtapi
        static void addExpert(MetaTrader mt)
        {
            var selectedChart = selectChart(mt.InstrumentCharts);

            if (selectedChart != null)
            {
                bool isController = false;

                Console.WriteLine("Is Expert controller (y/n) ?");

                ConsoleKeyInfo keyInfo = Console.ReadKey();
                Console.WriteLine();

                switch (keyInfo.Key)
                {
                case ConsoleKey.N:
                    isController = false;
                    break;

                case ConsoleKey.Y:
                    isController = true;
                    break;
                }

                Console.WriteLine("Input Port property (8222 - default): ");

                string portStr = Console.ReadLine();
                int    port    = 8222;
                if (int.TryParse(portStr, out port) == false)
                {
                    port = 8222;
                }
                var expert = new MtQuoteExpert(mt, port, isController);

                if (expert != null)
                {
                    selectedChart.AddExpert(expert);
                }
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: linyunfeng/mtapi
        static void addExpert(MetaTrader mt)
        {
            var selectedChart = selectChart(mt.InstrumentCharts);

            if (selectedChart != null)
            {
                bool isController = false;

                Console.WriteLine("Is Expert controller (y/n) ?");

                ConsoleKeyInfo keyInfo = Console.ReadKey();
                Console.WriteLine();

                switch (keyInfo.Key)
                {
                    case ConsoleKey.N:
                        isController = false;
                        break;
                    case ConsoleKey.Y:
                        isController = true;
                        break;
                }

                Console.WriteLine("Input Port property (8222 - default): ");

                string portStr = Console.ReadLine();
                int port = 8222;
                if (int.TryParse(portStr, out port) == false)
                    port = 8222;
                var expert = new MtQuoteExpert(mt, port, isController);

                if (expert != null)
                {
                    selectedChart.AddExpert(expert);
                }
            }
        }