Esempio n. 1
0
        /// <summary>
        /// LoadInstrument
        /// </summary>
        int LoadInstrument(bool bUseResource)
        {
            string      sSymbol    = "EURUSD";
            DataPeriods dataPeriod = DataPeriods.day;

            Instrument_Properties instrProperties = new Instrument_Properties(sSymbol);
            Instrument            instrument      = new Instrument(instrProperties, (int)dataPeriod);
            int iLoadDataResult = instrument.LoadResourceData();

            if (instrument.Bars > 0 && iLoadDataResult == 0)
            {
                Data.InstrProperties = instrProperties.Clone();

                Data.Bars   = instrument.Bars;
                Data.Period = dataPeriod;

                Data.Time   = new DateTime[Data.Bars];
                Data.Open   = new double[Data.Bars];
                Data.High   = new double[Data.Bars];
                Data.Low    = new double[Data.Bars];
                Data.Close  = new double[Data.Bars];
                Data.Volume = new int[Data.Bars];

                for (int iBar = 0; iBar < Data.Bars; iBar++)
                {
                    Data.Open[iBar]   = instrument.Open(iBar);
                    Data.High[iBar]   = instrument.High(iBar);
                    Data.Low[iBar]    = instrument.Low(iBar);
                    Data.Close[iBar]  = instrument.Close(iBar);
                    Data.Time[iBar]   = instrument.Time(iBar);
                    Data.Volume[iBar] = instrument.Volume(iBar);
                }

                Data.IsData = true;
            }

            return(0);
        }
Esempio n. 2
0
        /// <summary>
        /// LoadInstrument
        /// </summary>
        private void LoadInstrument()
        {
            const string      symbol     = "EURUSD";
            const DataPeriods dataPeriod = DataPeriods.day;

            var instrProperties  = new InstrumentProperties(symbol);
            var instrument       = new Instrument(instrProperties, (int)dataPeriod);
            int loadResourceData = instrument.LoadResourceData();

            if (instrument.Bars <= 0 || loadResourceData != 0)
            {
                return;
            }

            Data.InstrProperties = instrProperties.Clone();
            Data.Bars            = instrument.Bars;
            Data.Period          = dataPeriod;
            Data.Time            = new DateTime[Data.Bars];
            Data.Open            = new double[Data.Bars];
            Data.High            = new double[Data.Bars];
            Data.Low             = new double[Data.Bars];
            Data.Close           = new double[Data.Bars];
            Data.Volume          = new int[Data.Bars];

            for (int bar = 0; bar < Data.Bars; bar++)
            {
                Data.Open[bar]   = instrument.Open(bar);
                Data.High[bar]   = instrument.High(bar);
                Data.Low[bar]    = instrument.Low(bar);
                Data.Close[bar]  = instrument.Close(bar);
                Data.Time[bar]   = instrument.Time(bar);
                Data.Volume[bar] = instrument.Volume(bar);
            }

            Data.IsData = true;
        }
Esempio n. 3
0
        /// <summary>
        /// LoadInstrument
        /// </summary>
        private void LoadInstrument()
        {
            const string symbol = "EURUSD";
            const DataPeriods dataPeriod = DataPeriods.day;

            var instrProperties = new InstrumentProperties(symbol);
            var instrument = new Instrument(instrProperties, (int) dataPeriod);
            int loadResourceData = instrument.LoadResourceData();

            if (instrument.Bars <= 0 || loadResourceData != 0) return;

            Data.InstrProperties = instrProperties.Clone();
            Data.Bars = instrument.Bars;
            Data.Period = dataPeriod;
            Data.Time = new DateTime[Data.Bars];
            Data.Open = new double[Data.Bars];
            Data.High = new double[Data.Bars];
            Data.Low = new double[Data.Bars];
            Data.Close = new double[Data.Bars];
            Data.Volume = new int[Data.Bars];

            for (int bar = 0; bar < Data.Bars; bar++)
            {
                Data.Open[bar] = instrument.Open(bar);
                Data.High[bar] = instrument.High(bar);
                Data.Low[bar] = instrument.Low(bar);
                Data.Close[bar] = instrument.Close(bar);
                Data.Time[bar] = instrument.Time(bar);
                Data.Volume[bar] = instrument.Volume(bar);
            }

            Data.IsData = true;
        }
        /// <summary>
        /// LoadInstrument
        /// </summary>
        int LoadInstrument(bool bUseResource)
        {
            string      sSymbol    = "EURUSD";
            DataPeriods dataPeriod = DataPeriods.day;

            Instrument_Properties instrProperties = new Instrument_Properties(sSymbol);
            Instrument instrument = new Instrument(instrProperties, (int)dataPeriod);
            int iLoadDataResult = instrument.LoadResourceData();

            if (instrument.Bars > 0 && iLoadDataResult == 0)
            {
                Data.InstrProperties = instrProperties.Clone();

                Data.Bars   = instrument.Bars;
                Data.Period = dataPeriod;

                Data.Time   = new DateTime[Data.Bars];
                Data.Open   = new double[Data.Bars];
                Data.High   = new double[Data.Bars];
                Data.Low    = new double[Data.Bars];
                Data.Close  = new double[Data.Bars];
                Data.Volume = new int[Data.Bars];

                for (int iBar = 0; iBar < Data.Bars; iBar++)
                {
                    Data.Open[iBar]   = instrument.Open(iBar);
                    Data.High[iBar]   = instrument.High(iBar);
                    Data.Low[iBar]    = instrument.Low(iBar);
                    Data.Close[iBar]  = instrument.Close(iBar);
                    Data.Time[iBar]   = instrument.Time(iBar);
                    Data.Volume[iBar] = instrument.Volume(iBar);
                }

                Data.IsData = true;
            }

            return 0;
        }