public KagiChart(ChartView BaseChart)
        {
            kagi    = new Kagi();
            var     = new Variables.Variables();
            botAxis = BaseChart.Chart.Axes.Bottom;

            BaseChart.Chart.Axes.Left.AxisPen.Visible = true;
            BaseChart.Chart.Axes.Left.Visible         = true;
            BaseChart.Chart.Axes.Bottom.Visible       = true;
            BaseChart.Chart.Series.Add(kagi);

            kagi.BuySymbol.Visible  = true;
            kagi.SellSymbol.Visible = true;
            kagi.ReversalAmount     = 0.06;
            kagi.UpSwing.Visible    = true;
            kagi.UpSwing.Color      = Color.Green;
            kagi.UpSwing.Width      = 3;
            kagi.DownSwing.Color    = Color.Red;
            kagi.DownSwing.Width    = 2;
            kagi.AbsoluteReversal   = true;
            kagi.UpSwing.EndCap     = PenLineCap.Round;
            kagi.DownSwing.EndCap   = PenLineCap.Square;
            kagi.Pointer.Visible    = true;
            kagi.Pointer.HorizSize  = 20;
            kagi.Pointer.VertSize   = 20;
            kagi.Pointer.Color      = Color.Red;
            kagi.ClickableLine      = false;


            BaseChart.Chart.Axes.Left.Automatic        = true;
            BaseChart.Chart.Axes.Left.AutomaticMaximum = true;
            BaseChart.Chart.Axes.Left.AutomaticMinimum = true;

            for (int i = 0; i < var.GetValorKagiTime.Length; i++)
            {
                kagi.Add(var.GetValorKagiTime[i], var.GetValorsKagi[i, 0], var.GetValorsKagi[i, 1], var.GetValorsKagi[i, 2], var.GetValorsKagi[i, 3]);
            }

            BaseChart.Chart.Axes.Left.Increment          = 4;
            BaseChart.Chart.Axes.Left.Ticks.Transparency = 100;
            BaseChart.Chart.Axes.Left.Visible            = true;
            BaseChart.Chart.Axes.Left.AxisPen.Visible    = true;
            BaseChart.Chart.Legend.Visible = false;

            BaseChart.Chart.Axes.Bottom.SetMinMax(0, 2);
            BaseChart.Chart.Axes.Bottom.Increment = 1;

            BaseChart.Chart.Title.Text = "Kagi";
        }
Пример #2
0
        internal override void Paint(object drawingContext)
        {
            //if (_painted) return;

            Style ps = null;

            if (_priceStyleType != _chartPanel._chartX._priceStyle || _seriesTypeType != _seriesType)
            {
                if (_chartPanel._chartX._priceStyle != PriceStyleEnum.psStandard)
                {
                    switch (_chartPanel._chartX._priceStyle)
                    {
                    case PriceStyleEnum.psKagi:
                        ps = new Kagi(this);
                        break;

                    case PriceStyleEnum.psCandleVolume:
                    case PriceStyleEnum.psEquiVolume:
                    case PriceStyleEnum.psEquiVolumeShadow:
                        ps = new EquiVolume(this);
                        break;

                    case PriceStyleEnum.psPointAndFigure:
                        ps = new PointAndFigure(this);
                        break;

                    case PriceStyleEnum.psRenko:
                        ps = new Renko(this);
                        break;

                    case PriceStyleEnum.psThreeLineBreak:
                        ps = new ThreeLineBreak(this);
                        break;

                    case PriceStyleEnum.psHeikinAshi:
                        ps = new HeikinAshi(this);
                        break;
                    }
                }
                else
                {
                    switch (_seriesType)
                    {
                    case SeriesTypeEnum.stCandleChart:
                        ps = new Candles(this);
                        break;

                    case SeriesTypeEnum.stStockBarChartHLC:
                    case SeriesTypeEnum.stStockBarChart:
                        ps = new PriceStyles.Stock(this);
                        break;

                    case SeriesTypeEnum.stLineChart:
                        ps = new Linear(this);
                        break;
                    }
                }
                if (_priceStyle != null)
                {
                    _priceStyle.RemovePaint();
                }
            }

            if (_darvasBoxes != null)
            {
                _darvasBoxes.RemovePaint();
            }

            if (_chartPanel._chartX._priceStyle == PriceStyleEnum.psStandard || _chartPanel._chartX._priceStyle == PriceStyleEnum.psHeikinAshi)
            {
                if (_darvasBoxes == null)
                {
                    _darvasBoxes = new DarvasBoxes(this);
                }

                _darvasBoxes.SetSeriesStock(this);
                if (_chartPanel._chartX._darwasBoxes)
                {
                    _darvasBoxes.Paint();
                }
            }

            if (_priceStyle != null || ps != null)
            {
                (ps ?? _priceStyle).SetStockSeries(this);
                Style psToPaint = ps ?? _priceStyle;
                bool  res;
                if (psToPaint is Candles && drawingContext != null)
                {
                    res = psToPaint.Paint(drawingContext);
                }
                else
                {
                    res = psToPaint.Paint();
                }
                //if (!(ps ?? _priceStyle).Paint()) return;
                if (!res)
                {
                    return;
                }
            }

            if (Selected)
            {
                ShowSelection();
            }

            if (ps == null)
            {
                return;
            }

            _priceStyle     = ps;
            _priceStyleType = _chartPanel._chartX._priceStyle;
            _seriesTypeType = _seriesType;
        }