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> sc = i =>
            {
                double erValue = Convert.ToDouble(_er[i]);
                return(Convert.ToDecimal(Math.Pow(erValue * (2.0 / (emaFastPeriodCount + 1) - 2.0 / (emaSlowPeriodCount + 1)) + 2.0 / (emaSlowPeriodCount + 1), 2)));
            };

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

            PeriodCount        = periodCount;
            EmaFastPeriodCount = emaFastPeriodCount;
            EmaSlowPeriodCount = emaSlowPeriodCount;
        }
        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;
        }