public override void SaveToFile(string fileName)
 {
     lock (this)
     {
         CSVDataBarReaderWriter reader = new CSVDataBarReaderWriter(fileName, CSVDataBarReaderWriter.DataFormat.CSVHistoricalFileDefault);
         reader.Write(_data.AsReadOnly());
     }
 }
        public override void SaveToFile(string fileName)
        {
            if (_dataProvider == null)
            {
                return;
            }

            IDataBarHistoryProvider dataBarProvider = CurrentDataBarProvider;

            if (dataBarProvider == null)
            {
                return;
            }

            lock (dataBarProvider)
            {
                CSVDataBarReaderWriter reader = new CSVDataBarReaderWriter(fileName, CommonFinancial.CSVDataBarReaderWriter.DataFormat.CSVHistoricalFileDefault);
                reader.Write(dataBarProvider.BarsUnsafe);
            }
        }