Example #1
0
        public double Sum(int barCount)
        {
            double   sumResult       = double.MinValue;
            double   lastSum         = double.MinValue;
            DateTime lastSumDateTime = DateTime.MinValue;

            if (lastSums.ContainsKey(barCount))
            {
                lastSum         = lastSums[barCount].Sum;
                lastSumDateTime = lastSums[barCount].Timestamp;
                if (lastSum != double.MinValue && SecondToLast.Timestamp == lastSumDateTime)
                {
                    sumResult = IndicatorCalculator.NextSum(this, 0, lastSum, barCount);
                }
                else
                {
                    sumResult = IndicatorCalculator.Sum(this, 0, barCount);
                }
            }
            else
            {
                sumResult = IndicatorCalculator.Sum(this, 0, barCount);
                lastSums.Add(barCount, new Metadroids.Common.Models.SumItem(sumResult, FirstToLast.Timestamp));
            }

            lastSums[barCount].Set(sumResult, FirstToLast.Timestamp);

            return(sumResult);
        }
Example #2
0
 public double Sum(int barCount)
 {
     return(IndicatorCalculator.Sum(this, 0, barCount));
 }
Example #3
0
 public double Sum(int barCount, int valueIndex)
 {
     return(IndicatorCalculator <T> .Sum(this, valueIndex, barCount));
 }