Example #1
0
        /// <summary>
        /// очистить чарт
        /// </summary>
        public void Clear()
        {
            _myCandles = null;
            ChartCandle.ClearDataPointsAndSizeValue();
            _myPosition = null;


            for (int i = 0; _indicatorsCandles != null && i < _indicatorsCandles.Count; i++)
            {
                _indicatorsCandles[i].Clear();
            }
        }
Example #2
0
        /// <summary>
        /// прорисовать паттерн на его индивидуальном чарте
        /// </summary>
        private void PaintSinglePattern(IPattern pattern, ChartPainter chart)
        {
            if (chart.GetChart().InvokeRequired)
            {
                chart.GetChart().Invoke(new Action <IPattern, ChartPainter>(PaintSinglePattern), pattern, chart);
                return;
            }
            chart.ClearDataPointsAndSizeValue();
            chart.ClearSeries();

            if (pattern.Type == PatternType.Candle)
            {
                chart.PaintSingleCandlePattern(((PatternCandle)pattern).GetInCandle());
            }
            if (pattern.Type == PatternType.Volume)
            {
                chart.PaintSingleVolumePattern(((PatternVolume)pattern).GetInCandle());
            }
            if (pattern.Type == PatternType.Indicators)
            {
                PatternIndicators pat = (PatternIndicators)pattern;



                for (int i = 0; pat.Indicators != null && i < pat.Indicators.Count; i++)
                {
                    if (chart.IndicatorIsCreate(pat.Indicators[i].Name + "0") == false)
                    {
                        chart.CreateSeries(chart.GetChartArea(pat.Indicators[i].NameArea), pat.Indicators[i].TypeIndicator, pat.Indicators[i].NameSeries + "0");
                    }

                    chart.ProcessIndicator(pat.Indicators[i]);
                }
            }
        }
Example #3
0
 private void ButtonPaint_Click(object sender, RoutedEventArgs e)
 {
     _painter.ClearDataPointsAndSizeValue();
     if (_bot.MergeCandles != null && _bot.MergeCandles.Count != 0)
     {
         _painter.ProcessCandles(_bot.MergeCandles);
     }
 }
Example #4
0
        private void PaintActivTab(int tabNum)
        {
            if (_lastTabNum == tabNum)
            {
                return;
            }
            _lastTabNum = tabNum;

            if (_chart != null)
            {
                _chart.StopPaint();
                _chart.ClearDataPointsAndSizeValue();
                _chart.Delete();
            }


            if (tabNum < _panel.TabsSimple.Count)
            {
                _chart = new ChartPainter(_panel.NameStrategyUniq);
                _chart.ProcessCandles(_panel.TabsSimple[tabNum].CandlesFinishedOnly);
                _chart.StartPaintPrimeChart(ChartHostPanel, RectChart);
                _chart.ProcessPositions(_panel.TabsSimple[tabNum].PositionsAll);

                for (int i = 0; _panel.TabsSimple[tabNum].Indicators != null && i < _panel.TabsSimple[tabNum].Indicators.Count; i++)
                {
                    ChartArea area = _chart.CreateArea("Area" + _panel.TabsSimple[tabNum].Indicators[i].Name, 15);
                    _panel.TabsSimple[tabNum].Indicators[i].NameSeries = _chart.CreateSeries(area,
                                                                                             _panel.TabsSimple[tabNum].Indicators[i].TypeIndicator, _panel.TabsSimple[tabNum].Indicators[i].NameSeries);

                    _chart.ProcessIndicator(_panel.TabsSimple[tabNum].Indicators[i]);
                }
            }
            else
            {
                tabNum = tabNum - _panel.TabsSimple.Count;
                _chart = new ChartPainter(_panel.NameStrategyUniq);
                _chart.ProcessCandles(_panel.TabsIndex[tabNum].Candles);
                _chart.StartPaintPrimeChart(ChartHostPanel, RectChart);

                for (int i = 0; _panel.TabsIndex[tabNum].Indicators != null && i < _panel.TabsIndex[tabNum].Indicators.Count; i++)
                {
                    ChartArea area = _chart.CreateArea("Area" + _panel.TabsIndex[tabNum].Indicators[i].Name, 15);
                    _panel.TabsIndex[tabNum].Indicators[i].NameSeries = _chart.CreateSeries(area,
                                                                                            _panel.TabsIndex[tabNum].Indicators[i].TypeIndicator, _panel.TabsIndex[tabNum].Indicators[i].Name + i);

                    _chart.ProcessIndicator(_panel.TabsIndex[tabNum].Indicators[i]);
                }
            }
        }