コード例 #1
0
        /// <summary>
        /// Loads the data file
        /// </summary>
        /// <returns>0 - success</returns>
        public int LoadData()
        {
            // The source data file full name
            string sourceDataFile = DataDir + _instrProperties.BaseFileName + Period + ".csv";

            // Checks the access to the file
            if (!File.Exists(sourceDataFile))
                return 1;

            var sr = new StreamReader(sourceDataFile);
            string sData = sr.ReadToEnd();
            sr.Close();

            var dp = new DataParser();

            int respond = -1;
            int parsedBars = dp.Parse(sData);

            if (parsedBars > 0)
            {
                _aBar = dp.Bar;
                Bars = parsedBars;
                RefineData();
                DataHorizon();
                CheckMarketData();
                SetDataStats();
                Update = _aBar[Bars - 1].Time;
                respond = 0;
            }

            return respond;
        }
コード例 #2
0
        /// <summary>
        /// Loads the data file
        /// </summary>
        /// <returns>0 - success</returns>
        public int LoadResourceData()
        {
            var dataParser = new DataParser();
            int respond = -1;
            int parsedBars = dataParser.Parse(Resources.EURUSD1440);

            if (parsedBars > 0)
            {
                _aBar = dataParser.Bar;
                Bars = parsedBars;
                RefineData();
                DataHorizon();
                CheckMarketData();
                SetDataStats();
                Update = _aBar[Bars - 1].Time;
                respond = 0;
            }

            return respond;
        }
コード例 #3
0
        /// <summary>
        ///     Loads the data file
        /// </summary>
        /// <returns>0 - success</returns>
        public int LoadResourceData(string data, DataPeriods period)
        {
            var dataParser = new DataParser();
            int respond = -1;
            int parsedBars = dataParser.Parse(data, (int) period);

            if (parsedBars > 0)
            {
                _aBar = dataParser.Bar.ToArray();
                Bars = parsedBars;
                RefineData();
                DataHorizon();
                CheckMarketData();
                SetDataStats();
                Update = _aBar[Bars - 1].Time;
                respond = 0;
            }

            return respond;
        }