Esempio n. 1
0
        public MovingAverageConvergenceDivergence(Equity equity, int emaPeriodCount1, int emaPeriodCount2, int demPeriodCount)
            : base(equity, emaPeriodCount1, emaPeriodCount2, demPeriodCount)
        {
            _emaIndicator1 = new ExponentialMovingAverage(equity, emaPeriodCount1);
            _emaIndicator2 = new ExponentialMovingAverage(equity, emaPeriodCount2);
            _diff          = i => _emaIndicator1.ComputeByIndex(i).Ema - _emaIndicator2.ComputeByIndex(i).Ema;

            _dem = new GenericExponentialMovingAverage(
                equity,
                0,
                i => _diff(i),
                i => _diff(i),
                i => 2.0m / (demPeriodCount + 1));
        }
Esempio n. 2
0
        protected override IndicatorResult ComputeByIndexImpl(int index)
        {
            var osc = _emaIndicator1.ComputeByIndex(index).Ema - _emaIndicator2.ComputeByIndex(index).Ema;

            return(new IndicatorResult(Equity[index].DateTime, osc));
        }