Пример #1
0
        static void removeChart(MetaTrader mt)
        {
            var selectedChart = selectChart(mt.InstrumentCharts);

            if (selectedChart != null)
            {
                mt.RemoveInstrumentChart(selectedChart);
            }
        }
Пример #2
0
        static MetaTrader createMetaTrader(string accountName, int accountNumber)
        {
            MetaTrader mt = new MetaTrader(accountName, accountNumber);

            mt.AddInstrument(new MtInstrument("EURUSD", 1.3, 1.4));
            mt.AddInstrument(new MtInstrument("EURJPY", 1.3, 1.4));
            mt.AddInstrument(new MtInstrument("EURAUD", 1.3, 1.4));
            mt.AddInstrument(new MtInstrument("USDAUD", 1.3, 1.4));
            mt.AddInstrument(new MtInstrument("USDJPY", 1.3, 1.4));

            return mt;
        }
Пример #3
0
        static MetaTrader createMetaTrader(string accountName, int accountNumber)
        {
            MetaTrader mt = new MetaTrader(accountName, accountNumber);

            mt.AddInstrument(new MtInstrument("EURUSD", 1.3, 1.4));
            mt.AddInstrument(new MtInstrument("EURJPY", 1.3, 1.4));
            mt.AddInstrument(new MtInstrument("EURAUD", 1.3, 1.4));
            mt.AddInstrument(new MtInstrument("USDAUD", 1.3, 1.4));
            mt.AddInstrument(new MtInstrument("USDJPY", 1.3, 1.4));

            return(mt);
        }
Пример #4
0
        static void addChart(MetaTrader mt)
        {
            Console.Clear();
            Console.WriteLine("Adding Chart.");

            var selectedIinstrument = selectInstrument(mt.Instruments);

            if (selectedIinstrument != null)
            {
                var instrumentChart = new MtInstrumentChart(selectedIinstrument);

                mt.AddInstrumentChart(instrumentChart);
            }
        }
Пример #5
0
        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);
                }
            }
        }
Пример #6
0
        static void addChart(MetaTrader mt)
        {
            Console.Clear();
            Console.WriteLine("Adding Chart.");

            var selectedIinstrument = selectInstrument(mt.Instruments);

            if (selectedIinstrument != null)
            {
                var instrumentChart = new MtInstrumentChart(selectedIinstrument);

                mt.AddInstrumentChart(instrumentChart);
            }
        }
Пример #7
0
        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);
                }
            }
        }
Пример #8
0
        static void removeChart(MetaTrader mt)
        {
            var selectedChart = selectChart(mt.InstrumentCharts);

            if (selectedChart != null)
            {
                mt.RemoveInstrumentChart(selectedChart);
            }
        }