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));
        }
        private void InitOverlays()
        {
            defaultSeries = new FinancialSeries()
            {
                Name = "Box"
            };
            bollingerBands = new BollingerBands()
            {
                Name = "Bollinger Bands"
            };
            envelopes = new Envelopes()
            {
                Name = "Envoloper"
            };
            ichimokuCloud = new IchimokuCloud()
            {
                Name = "Ichimoku Cloud",
                ConversionLineStyle = new C1.Win.Chart.ChartStyle()
                {
                    StrokeColor = Color.Orange
                },
                BaseLineStyle = new C1.Win.Chart.ChartStyle()
                {
                    StrokeColor = Color.Blue
                },
                LaggingLineStyle = new C1.Win.Chart.ChartStyle()
                {
                    StrokeColor = Color.Black
                },
                LeadingSpanALineStyle = new C1.Win.Chart.ChartStyle()
                {
                    StrokeColor = Color.LightGreen
                },
                LeadingSpanBLineStyle = new C1.Win.Chart.ChartStyle()
                {
                    StrokeColor = Color.IndianRed
                },
                BullishCloudColor = new SolidBrush(Color.LightGreen),
                BearishCloudColor = new SolidBrush(Color.IndianRed)
            };

            zigZag = new ZigZag()
            {
                Name = "ZigZag"
            };
            zigZag.Style.StrokeColor = Color.Green;
            zigZag.Style.StrokeWidth = 0.8f;

            alligator = new Alligator()
            {
                Name         = "Alligator",
                JawLineStyle = new C1.Win.Chart.ChartStyle()
                {
                    StrokeColor = Color.LightGreen
                },
                TeethLineStyle = new C1.Win.Chart.ChartStyle()
                {
                    StrokeColor = Color.IndianRed
                },
                LipsLineStyle = new C1.Win.Chart.ChartStyle()
                {
                    StrokeColor = Color.Black
                },
            };
        }