Пример #1
0
        /// <summary>
        /// Расчет Болинжера по _countPeriod и _kstd
        /// </summary>
        private async Task CreateRepositoryBolinger(MarketTradesRepository _mtr, int _countPeriod, double _kstd, string _fileNameInp)
        {
            double High_line = 0;
            double Midl_line = 0;
            double Low_line  = 0;

            double                   price;
            List <double>            priceList    = new List <double>();
            TradesBolingerRepository _trdBReposit = new TradesBolingerRepository();

            await Task.Run(() =>
            {
                foreach (ParametrMarketTrades item in _mtr)
                {
                    price = (double)item.PriceTrades;

                    priceList.Add(price);

                    if (priceList.Count == _countPeriod)
                    {
                        StaticCalculations.BollingerBands(priceList, _kstd, ref High_line, ref Midl_line, ref Low_line);
                        priceList.RemoveAt(0);
                        _trdBReposit.Add(new ParametrTradesBolinger(item.DateTimeTrades, item.NumberTrades, item.PriceTrades, item.SeccodeTrades, High_line, Low_line, Midl_line));
                    }
                }
                string _fileName = _fileNameInp + StaticService.GenerateKey(_countPeriod, _kstd);
                StaticService.Serializes(_trdBReposit, folderOut + _fileName);
            });
        }