Esempio n. 1
0
        public void ichimoku()
        {
            IchimokuTenkanSenIndicator   tenkanSen   = new IchimokuTenkanSenIndicator(data, 3);
            IchimokuKijunSenIndicator    kijunSen    = new IchimokuKijunSenIndicator(data, 5);
            IchimokuSenkouSpanAIndicator senkouSpanA = new IchimokuSenkouSpanAIndicator(data, tenkanSen, kijunSen);
            IchimokuSenkouSpanBIndicator senkouSpanB = new IchimokuSenkouSpanBIndicator(data, 9);
            IchimokuChikouSpanIndicator  chikouSpan  = new IchimokuChikouSpanIndicator(data, 5);

            Assert.AreEqual(tenkanSen.GetValue(3), 45.155M);
            Assert.AreEqual(tenkanSen.GetValue(4), 45.18M);
            Assert.AreEqual(tenkanSen.GetValue(5), 45.145M);
            Assert.AreEqual(tenkanSen.GetValue(6), 45.135M);
            Assert.AreEqual(tenkanSen.GetValue(7), 45.145M);
            Assert.AreEqual(tenkanSen.GetValue(8), 45.17M);
            Assert.AreEqual(tenkanSen.GetValue(16), 44.06M);
            Assert.AreEqual(tenkanSen.GetValue(17), 43.675M);
            Assert.AreEqual(tenkanSen.GetValue(18), 43.525M);

            Assert.AreEqual(kijunSen.GetValue(3), 45.14M);
            Assert.AreEqual(kijunSen.GetValue(4), 45.14M);
            Assert.AreEqual(kijunSen.GetValue(5), 45.155M);
            Assert.AreEqual(kijunSen.GetValue(6), 45.18M);
            Assert.AreEqual(kijunSen.GetValue(7), 45.145M);
            Assert.AreEqual(kijunSen.GetValue(8), 45.17M);
            Assert.AreEqual(kijunSen.GetValue(16), 44.345M);
            Assert.AreEqual(kijunSen.GetValue(17), 44.305M);
            Assert.AreEqual(kijunSen.GetValue(18), 44.05M);

            Assert.AreEqual(senkouSpanA.GetValue(3), 45.1475M);
            Assert.AreEqual(senkouSpanA.GetValue(4), 45.16M);
            Assert.AreEqual(senkouSpanA.GetValue(5), 45.15M);
            Assert.AreEqual(senkouSpanA.GetValue(6), 45.1575M);
            Assert.AreEqual(senkouSpanA.GetValue(7), 45.145M);
            Assert.AreEqual(senkouSpanA.GetValue(8), 45.17M);
            Assert.AreEqual(senkouSpanA.GetValue(16), 44.2025M);
            Assert.AreEqual(senkouSpanA.GetValue(17), 43.99M);
            Assert.AreEqual(senkouSpanA.GetValue(18), 43.7875M);

            Assert.AreEqual(senkouSpanB.GetValue(3), 45.14M);
            Assert.AreEqual(senkouSpanB.GetValue(4), 45.14M);
            Assert.AreEqual(senkouSpanB.GetValue(5), 45.14M);
            Assert.AreEqual(senkouSpanB.GetValue(6), 45.14M);
            Assert.AreEqual(senkouSpanB.GetValue(7), 45.14M);
            Assert.AreEqual(senkouSpanB.GetValue(8), 45.14M);
            Assert.AreEqual(senkouSpanB.GetValue(16), 44.345M);
            Assert.AreEqual(senkouSpanB.GetValue(17), 44.335M);
            Assert.AreEqual(senkouSpanB.GetValue(18), 44.335M);

            Assert.AreEqual(chikouSpan.GetValue(5), 45.05M);
            Assert.AreEqual(chikouSpan.GetValue(6), 45.10M);
            Assert.AreEqual(chikouSpan.GetValue(7), 45.19M);
            Assert.AreEqual(chikouSpan.GetValue(8), 45.14M);
            Assert.AreEqual(chikouSpan.GetValue(19), 44.23M);
        }
        public void Ichimoku()
        {
            var tenkanSen   = new IchimokuTenkanSenIndicator(_data, 3);
            var kijunSen    = new IchimokuKijunSenIndicator(_data, 5);
            var senkouSpanA = new IchimokuSenkouSpanAIndicator(_data, tenkanSen, kijunSen);
            var senkouSpanB = new IchimokuSenkouSpanBIndicator(_data, 9);
            var chikouSpan  = new IchimokuChikouSpanIndicator(_data, 5);

            TaTestsUtils.AssertDecimalEquals(tenkanSen.GetValue(3), 45.155);
            TaTestsUtils.AssertDecimalEquals(tenkanSen.GetValue(4), 45.18);
            TaTestsUtils.AssertDecimalEquals(tenkanSen.GetValue(5), 45.145);
            TaTestsUtils.AssertDecimalEquals(tenkanSen.GetValue(6), 45.135);
            TaTestsUtils.AssertDecimalEquals(tenkanSen.GetValue(7), 45.145);
            TaTestsUtils.AssertDecimalEquals(tenkanSen.GetValue(8), 45.17);
            TaTestsUtils.AssertDecimalEquals(tenkanSen.GetValue(16), 44.06);
            TaTestsUtils.AssertDecimalEquals(tenkanSen.GetValue(17), 43.675);
            TaTestsUtils.AssertDecimalEquals(tenkanSen.GetValue(18), 43.525);

            TaTestsUtils.AssertDecimalEquals(kijunSen.GetValue(3), 45.14);
            TaTestsUtils.AssertDecimalEquals(kijunSen.GetValue(4), 45.14);
            TaTestsUtils.AssertDecimalEquals(kijunSen.GetValue(5), 45.155);
            TaTestsUtils.AssertDecimalEquals(kijunSen.GetValue(6), 45.18);
            TaTestsUtils.AssertDecimalEquals(kijunSen.GetValue(7), 45.145);
            TaTestsUtils.AssertDecimalEquals(kijunSen.GetValue(8), 45.17);
            TaTestsUtils.AssertDecimalEquals(kijunSen.GetValue(16), 44.345);
            TaTestsUtils.AssertDecimalEquals(kijunSen.GetValue(17), 44.305);
            TaTestsUtils.AssertDecimalEquals(kijunSen.GetValue(18), 44.05);

            TaTestsUtils.AssertDecimalEquals(senkouSpanA.GetValue(3), 45.1475);
            TaTestsUtils.AssertDecimalEquals(senkouSpanA.GetValue(4), 45.16);
            TaTestsUtils.AssertDecimalEquals(senkouSpanA.GetValue(5), 45.15);
            TaTestsUtils.AssertDecimalEquals(senkouSpanA.GetValue(6), 45.1575);
            TaTestsUtils.AssertDecimalEquals(senkouSpanA.GetValue(7), 45.145);
            TaTestsUtils.AssertDecimalEquals(senkouSpanA.GetValue(8), 45.17);
            TaTestsUtils.AssertDecimalEquals(senkouSpanA.GetValue(16), 44.2025);
            TaTestsUtils.AssertDecimalEquals(senkouSpanA.GetValue(17), 43.99);
            TaTestsUtils.AssertDecimalEquals(senkouSpanA.GetValue(18), 43.7875);

            TaTestsUtils.AssertDecimalEquals(senkouSpanB.GetValue(3), 45.14);
            TaTestsUtils.AssertDecimalEquals(senkouSpanB.GetValue(4), 45.14);
            TaTestsUtils.AssertDecimalEquals(senkouSpanB.GetValue(5), 45.14);
            TaTestsUtils.AssertDecimalEquals(senkouSpanB.GetValue(6), 45.14);
            TaTestsUtils.AssertDecimalEquals(senkouSpanB.GetValue(7), 45.14);
            TaTestsUtils.AssertDecimalEquals(senkouSpanB.GetValue(8), 45.14);
            TaTestsUtils.AssertDecimalEquals(senkouSpanB.GetValue(16), 44.345);
            TaTestsUtils.AssertDecimalEquals(senkouSpanB.GetValue(17), 44.335);
            TaTestsUtils.AssertDecimalEquals(senkouSpanB.GetValue(18), 44.335);

            TaTestsUtils.AssertDecimalEquals(chikouSpan.GetValue(5), 45.05);
            TaTestsUtils.AssertDecimalEquals(chikouSpan.GetValue(6), 45.10);
            TaTestsUtils.AssertDecimalEquals(chikouSpan.GetValue(7), 45.19);
            TaTestsUtils.AssertDecimalEquals(chikouSpan.GetValue(8), 45.14);
            TaTestsUtils.AssertDecimalEquals(chikouSpan.GetValue(19), 44.23);
        }
 protected override Decimal Calculate(int index)
 {
     return(_conversionLine.GetValue(index).Plus(_baseLine.GetValue(index)).DividedBy(Decimal.Two));
 }