Пример #1
0
        public void Start()
        {
            FinancialTimeSpans.All.ForEach(timeFrame => {
                string path = new SeriesDescriptor()
                              .InstrumentDescriptors.Single(x => x.Name == "EURUSD")
                              .ProviderDescriptors.Single(x => x.Name == "Dukascopy")
                              .Path;

                BarsReader reader = BarsReader.Create(timeFrame, path);

                if (reader != null)
                {
                    IndicatorsCreator creator = new IndicatorsCreator(timeFrame, path);
                    creator.AddIndicator(new RSI(15));
                    creator.AddIndicator(new RSI(20));
                    creator.AddIndicator(new RSI(25));

                    DateTime dateTime;
                    decimal price;
                    int lastMonth = -1;

                    while (reader.Next(out dateTime, out price))
                    {
                        creator.Update(dateTime, price);
                        if (dateTime.Month != lastMonth)
                        {
                            Console.WriteLine("{0} -> {1} -> {2}", dateTime, price, CreateString(creator.Values));
                            lastMonth = dateTime.Month;
                        }
                    }

                    creator.Finish();
                }
            });
        }
Пример #2
0
        static void Main(string[] args)
        {
            string path = new SeriesDescriptor()
                          .InstrumentDescriptors.Single(x => x.Name == "EURUSD")
                          .ProviderDescriptors.Single(x => x.Name == "Dukascopy")
                          .Path;

            BarsReader reader = BarsReader.Create(TimeSpan.FromHours(1), path /*, new DateTime(2010, 1, 1), new DateTime(2010, 2, 1)*/);

            DateTime dateTime;
            decimal  price;

            while (reader.Next(out dateTime, out price))
            {
                Console.WriteLine("{0} -> {1}", dateTime, price);
            }

            Console.ReadLine();
        }