Exemple #1
0
        public async Task TestIchimokuCloudAsync()
        {
            var candles = await ImportCandlesAsync();

            int middlePeriodCount = 26;
            var indicator         = new IchimokuCloud(candles, 9, middlePeriodCount, 52);
            var results           = indicator.Compute();

            var currResult = results[results.Count - middlePeriodCount - 1];

            Assert.IsTrue(138.70m.IsApproximatelyEquals(currResult.ConversionLine.Value));
            Assert.IsTrue(136.45m.IsApproximatelyEquals(currResult.BaseLine.Value));

            var leadingResult = results.Last();

            Assert.IsTrue(137.57m.IsApproximatelyEquals(leadingResult.LeadingSpanA.Value));
            Assert.IsTrue(128.82m.IsApproximatelyEquals(leadingResult.LeadingSpanB.Value));

            var laggingResult = results[results.Count - 2 * middlePeriodCount - 1];

            Assert.IsTrue(139.94m.IsApproximatelyEquals(laggingResult.LaggingSpan.Value));
        }
Exemple #2
0
        public async Task TestIchimokuCloudAsync()
        {
            var equity = await ImportEquityAsync();

            var indicator = new IchimokuCloud(equity, 9, 26, 52);
            var results   = indicator.Compute(null, null);

            File.WriteAllText("result.csv", string.Join("\n", results.Select(r => $"{r.DateTime},{r.ConversionLine},{r.BaseLine},{r.LeadingSpanA},{r.LeadingSpanB},{r.LaggingSpan}")));

            var currResult = results.Single(r => r.DateTime.Equals(new DateTime(2017, 3, 20)));

            Assert.IsTrue(138.70m.IsApproximatelyEquals(currResult.ConversionLine.Value));
            Assert.IsTrue(136.45m.IsApproximatelyEquals(currResult.BaseLine.Value));

            var leadingResult = results.Single(r => r.DateTime.Equals(new DateTime(2017, 4, 25)));

            Assert.IsTrue(137.57m.IsApproximatelyEquals(leadingResult.LeadingSpanA.Value));
            Assert.IsTrue(128.82m.IsApproximatelyEquals(leadingResult.LeadingSpanB.Value));

            var laggingResult = results.Single(r => r.DateTime.Equals(new DateTime(2017, 2, 10)));

            Assert.IsTrue(139.94m.IsApproximatelyEquals(laggingResult.LaggingSpan.Value));
        }