Exemplo n.º 1
0
        public void Dpo()
        {
            var dpo       = new DpoIndicator(_series, 9);
            var cp        = new ClosePriceIndicator(_series);
            var sma       = new SmaIndicator(cp, 9);
            int timeShift = 9 / 2 + 1;

            for (int i = _series.Begin; i <= _series.End; i++)
            {
                TaTestsUtils.AssertDecimalEquals(dpo.GetValue(i), cp.GetValue(i).Minus(sma.GetValue(i - timeShift)));
            }

            TaTestsUtils.AssertDecimalEquals(dpo.GetValue(9), 0.111999);
            TaTestsUtils.AssertDecimalEquals(dpo.GetValue(10), -0.02);
            TaTestsUtils.AssertDecimalEquals(dpo.GetValue(11), 0.21142857142);
            TaTestsUtils.AssertDecimalEquals(dpo.GetValue(12), 0.169999999999999);
        }
Exemplo n.º 2
0
        public void DpoIoobe()
        {
            var dpo = new DpoIndicator(_series, 9);

            Assert.Throws <IndexOutOfRangeException>(() => dpo.GetValue(100));
        }