Exemple #1
0
 public void Load(string file)
 {
     if (File.Exists(file))
     {
         try
         {
             StreamReader file_reader     = new StreamReader(file, Encoding.Default);
             StreamReader buffered_reader = new System.IO.StreamReader(file_reader.BaseStream, file_reader.CurrentEncoding);
             string       line;
             ArrayList    temp = new ArrayList();
             buffered_reader.ReadLine();  // skip header
             while ((line = buffered_reader.ReadLine()) != null)
             {
                 TechnicalData data = ParseLine(line);
                 if (data != null)
                 {
                     temp.Add(data);
                 }
             }
             for (int i = temp.Count - 1; i >= 0; i--)
             {
                 _technicalData.Add(temp[i]);
             }
             _technicalDataStartDate = ((TechnicalData)_technicalData[0]).Date;
             _technicalDataEndDate   = ((TechnicalData)_technicalData[_technicalData.Count - 1]).Date;
             buffered_reader.Close();
             file_reader.Close();
         }
         finally
         {
         }
     }
 }
Exemple #2
0
 public virtual void Next()
 {
     if (HasNext())
     {
         _technicalDataIndex++;
         _technicalDataCurrent = null;
     }
 }
Exemple #3
0
 public TechnicalData GetCurrent()
 {
     if (_technicalDataCurrent == null)
     {
         _technicalDataCurrent = (TechnicalData)_technicalData[_technicalDataIndex];
     }
     return(_technicalDataCurrent);
 }
Exemple #4
0
        private TechnicalData ParseLine(string line)
        {
            string[] dataArray = new string[7];
            Regex    rex       = new Regex(",(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))");

            dataArray = rex.Split(line);
            DateTime      dateTime = DateTime.Parse(dataArray[0]);
            TechnicalData data     = new TechnicalData(dateTime, double.Parse(dataArray[1]), double.Parse(dataArray[2]), double.Parse(dataArray[3]), double.Parse(dataArray[4]), long.Parse(dataArray[5]), double.Parse(dataArray[6]));

            return(data);
        }
 /// <summary>Adds TechnicalData object to the indicator</summary>
 /// <param name="data">TechnicalData object to be added</param>
 public virtual void AddData(TechnicalData data)
 {
     _date = ((TechnicalData)data).Date;
     GenerateSignal();
 }
Exemple #6
0
 public void Initialize()
 {
     _technicalDataIndex   = 0;
     _technicalDataCurrent = null;
 }