Example #1
0
        public void dpo()
        {
            DPOIndicator        dpo = new DPOIndicator(series, 9);
            ClosePriceIndicator cp  = new ClosePriceIndicator(series);
            SMAIndicator        sma = new SMAIndicator(cp, 9);
            int timeShift           = 9 / 2 + 1;

            for (int i = series.GetBeginIndex(); i <= series.GetEndIndex(); i++)
            {
                Assert.AreEqual(dpo.GetValue(i), cp.GetValue(i).Minus(sma.GetValue(i - timeShift)));
            }

            Assert.AreEqual(dpo.GetValue(9), 0.112M);
            Assert.AreEqual(dpo.GetValue(10), -0.02M);
            Assert.AreEqual(dpo.GetValue(11), 0.211428571428571428571428571M);
            Assert.AreEqual(dpo.GetValue(12), 0.17M);
        }
Example #2
0
        // [TestMethod] (expected = IndexOutOfBoundsException.class)
        public void dpoIOOBE()
        {
            DPOIndicator dpo = new DPOIndicator(series, 9);

            dpo.GetValue(100);
        }