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); }
public double Sum(int barCount) { return(IndicatorCalculator.Sum(this, 0, barCount)); }
public double Sum(int barCount, int valueIndex) { return(IndicatorCalculator <T> .Sum(this, valueIndex, barCount)); }