Ejemplo n.º 1
0
        public void coppockCurveWithRoc14Roc11Wma10()
        {
            // Example from http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:coppock_curve
            ITimeSeries data = new MockTimeSeries(
                872.81M, 919.14M, 919.32M, 987.48M, 1020.62M,
                1057.08M, 1036.19M, 1095.63M, 1115.1M, 1073.87M,
                1104.49M, 1169.43M, 1186.69M, 1089.41M, 1030.71M,
                1101.6M, 1049.33M, 1141.2M, 1183.26M, 1180.55M,
                1257.64M, 1286.12M, 1327.22M, 1325.83M, 1363.61M,
                1345.2M, 1320.64M, 1292.28M, 1218.89M, 1131.42M,
                1253.3M, 1246.96M, 1257.6M, 1312.41M, 1365.68M,
                1408.47M, 1397.91M, 1310.33M, 1362.16M, 1379.32M
                );

            CoppockCurveIndicator cc = new CoppockCurveIndicator(new ClosePriceIndicator(data), 14, 11, 10);

            Assert.AreEqual(cc.GetValue(31), 23.892855086922197744287818351M);
            Assert.AreEqual(cc.GetValue(32), 19.318661466425348019588229135M);
            Assert.AreEqual(cc.GetValue(33), 16.350542803958196462308468202M);
            Assert.AreEqual(cc.GetValue(34), 14.119931234084269587181699349M);
            Assert.AreEqual(cc.GetValue(35), 12.782034421286169059841703773M);
            Assert.AreEqual(cc.GetValue(36), 11.39242630956381711118490345M);
            Assert.AreEqual(cc.GetValue(37), 8.366161426264314349758720221M);
            Assert.AreEqual(cc.GetValue(38), 7.4532394830272277872914349091M);
            Assert.AreEqual(cc.GetValue(39), 8.790068424954794622463894475M);
        }
        public void CoppockCurveWithRoc14Roc11Wma10()
        {
            // Example from http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:coppock_curve
            TimeSeries data = GenerateTimeSeries.From(872.81, 919.14, 919.32, 987.48, 1020.62, 1057.08, 1036.19, 1095.63, 1115.1, 1073.87, 1104.49, 1169.43, 1186.69, 1089.41, 1030.71, 1101.6, 1049.33, 1141.2, 1183.26, 1180.55, 1257.64, 1286.12, 1327.22, 1325.83, 1363.61, 1345.2, 1320.64, 1292.28, 1218.89, 1131.42, 1253.3, 1246.96, 1257.6, 1312.41, 1365.68, 1408.47, 1397.91, 1310.33, 1362.16, 1379.32);

            var cc = new CoppockCurveIndicator(new ClosePriceIndicator(data), 14, 11, 10);

            TaTestsUtils.AssertDecimalEquals(cc.GetValue(31), 23.8929);
            TaTestsUtils.AssertDecimalEquals(cc.GetValue(32), 19.3187);
            TaTestsUtils.AssertDecimalEquals(cc.GetValue(33), 16.3505);
            TaTestsUtils.AssertDecimalEquals(cc.GetValue(34), 14.12);
            TaTestsUtils.AssertDecimalEquals(cc.GetValue(35), 12.782);
            TaTestsUtils.AssertDecimalEquals(cc.GetValue(36), 11.3924);
            TaTestsUtils.AssertDecimalEquals(cc.GetValue(37), 8.3662);
            TaTestsUtils.AssertDecimalEquals(cc.GetValue(38), 7.4532);
            TaTestsUtils.AssertDecimalEquals(cc.GetValue(39), 8.79);
        }