public ExponentialMovingAverage(IEnumerable <TInput> inputs, Func <TInput, decimal?> inputMapper, int periodCount) : base(inputs, inputMapper)
        {
            _ema = new GenericMovingAverage(
                i => inputs.Select(inputMapper).ElementAt(i),
                Smoothing.Ema(periodCount),
                inputs.Count());

            PeriodCount = periodCount;
        }
        public KaufmanAdaptiveMovingAverage(IEnumerable <TInput> inputs, Func <TInput, decimal> inputMapper, int periodCount, int emaFastPeriodCount, int emaSlowPeriodCount) : base(inputs, inputMapper)
        {
            _er = new EfficiencyRatioByTuple(inputs.Select(inputMapper), periodCount);

            Func <int, decimal> smoothingFactor = i =>
            {
                var s = Smoothing.Ema(emaSlowPeriodCount)(i) + _er[i].Value * (Smoothing.Ema(emaFastPeriodCount)(i) - Smoothing.Ema(emaSlowPeriodCount)(i));
                return(s * s);
            };

            _gma = new GenericMovingAverage(
                periodCount - 1,
                i => inputs.Select(inputMapper).ElementAt(i),
                i => inputs.Select(inputMapper).ElementAt(i),
                smoothingFactor,
                inputs.Count());

            PeriodCount        = periodCount;
            EmaFastPeriodCount = emaFastPeriodCount;
            EmaSlowPeriodCount = emaSlowPeriodCount;
        }