Пример #1
0
        /// <summary>
        /// Отрисовка активных частей
        /// </summary>
        /// <param name="dCan"></param>
        /// <returns></returns>
        protected bool PaintActual(CandleInfo dCan)
        {
            if (!Candels.PaintLastCandle(dCan))
            {
                return(false);
            }
            //Проверка на перерисовку
            if (MainPanel.Params.Redraw())
            {
                PaintAll();
                return(false);
            }
            //Обычные обьемы
            Volumes.GetFirstLevel().Volume = dCan.Candle.Volume;
            if (!Volumes.PaintLast(dCan))
            {
                return(false);
            }

            RightPrices.PaintCurrentValue(dCan.Candle.Close, MainPanel.Params.MaxPrice, MainPanel.Params.MinPrice);
            if (dCan.Candle.Close > MainPanel.Params.MaxPrice || dCan.Candle.Close < MainPanel.Params.MinPrice)
            {
                if (MainPanel.Params.AutoSize)
                {
                    if (OnReachLimitPrice.NotIsNull())
                    {
                        OnReachLimitPrice(dCan.Candle.Close, MainPanel.Params.MaxPrice, MainPanel.Params.MinPrice);
                    }
                }
            }

            Indicators.ForEach((objIndicator) =>
            {
                if (objIndicator is Indicator)
                {
                    var obj = (Indicator)objIndicator;
                    if (obj.FastRedraw)
                    {
                        obj.FastUpdate();
                    }
                }
            });
            return(true);
        }
Пример #2
0
        /// <summary> Расчет панелей</summary>
        private void GetRectsPanels()
        {
            Candels.Panel.SetRect(MainPanel.ExtractBottom(0));

            Cross.Panel.SetRect(Candels.Panel.ExtractBottom(0));

            Times.Panel.SetRect(Candels.Panel.ExtractBottom(20));
            Times.Panel.SetRect(GRectangle.Join(Candels.Panel.RectScreen, Times.Panel.RectScreen));

            //Interest.Panel.SetRect(Candels.Panel.ExtractBottom(50));
            //DeltaVol.Panel.SetRect(Candels.Panel.ExtractBottom(50));
            Volumes.Panel.SetRect(Candels.Panel.ExtractBottom(60));

            ///////////////////////////
            /// Right panels
            ///////////////////////////
            RightPrices.Panel.SetRect(Candels.Panel.ExtractRight(RightPrices.WidthBorder));
            RightPrices.Panel.SetRect(GRectangle.Join(Candels.Panel.RectScreen, RightPrices.Panel.RectScreen));

            GHorVolumes.Panel.SetRect(Candels.Panel.RectScreen);
            GHorVolumes.PanelVolume.SetRect(Candels.Panel.ExtractRight(150));
            Candels.Panel.ExtractRight(15);

            //Ширина свечки
            float WidthOneCandle = Candels.GetWidthOne();

            Cross.HeightForPrice = Candels.Panel.RectScreen.Height;
            Times.WidthOneCandle = WidthOneCandle;
            //Ширина области значений в нижних панелях
            Volumes.Values.SetWidthValues(RightPrices.WidthBorder);
            //DeltaVol.Values.SetWidthValues(RightPrices.WidthBorder);
            //Interest.Values.SetWidthValues(RightPrices.WidthBorder);

            LevelsOrders.Panel.SetRect(Candels.Panel.RectScreen);
            Levels.Panel.SetRect(Candels.Panel.RectScreen);
        }
Пример #3
0
        /// <summary>Отрисовка всего графика </summary>
        /// <param name="graphic">Полотно</param>
        protected void PaintAll()
        {
            if (!Candels.IssetCollection())
            {
                return;
            }
            GetMinMax();
            //Отрисовка свечей в приоритете
            Candels.PaintCandles();

            RightPrices.Paint(RightPrices.Panel.Params.MaxPrice, RightPrices.Panel.Params.MinPrice);

            if (ActiveCandles.ActiveCandle1.NotIsNull() && ActiveCandles.ActiveCandle2.NotIsNull())
            {
                if (ActiveCandles.ActiveCandle1.dataCandle.Index > ActiveCandles.ActiveCandle2.dataCandle.Index)
                {
                    GHorVolumes.activeCandle1 = ActiveCandles.ActiveCandle1;
                    GHorVolumes.activeCandle2 = ActiveCandles.ActiveCandle2;
                }
                else
                {
                    GHorVolumes.activeCandle1 = ActiveCandles.ActiveCandle2;
                    GHorVolumes.activeCandle2 = ActiveCandles.ActiveCandle1;
                }
                if (TypeHorVolume == 3)
                {
                    GHorVolumes.activeCandle2 = null;
                }
            }

            CandleInfo LastCandle = null;

            Levels.Panel.Clear();
            var leftCandle  = Candels.AllDataPaintedCandle.Last();
            var rightCandle = Candels.AllDataPaintedCandle.First();

            //Паинт
            foreach (var dCandle in Candels.AllDataPaintedCandle.ToArray())
            {
                dCandle.PrevCandleInfo = LastCandle;
                Volumes.PaintByCandle(dCandle);
                GHorVolumes.EachCandle(dCandle);
                Levels.PaintByCandle(dCandle, leftCandle, rightCandle, Candels.AllDataPaintedCandle.Count);
                Indicators.ForEach((ind) =>
                {
                    if (ind is Indicator)
                    {
                        ((Indicator)ind).EachFullCandle(dCandle);
                    }
                });
                LastCandle = dCandle;
            }

            LevelsOrders.Paint();
            Levels.Paint();

            ActualizeActiveCandle();
            if (ThreadPaintHotVol.NotIsNull())
            {
                ThreadPaintHotVol.Abort();
                ThreadPaintHotVol = null;
            }
            if (ThreadPaintHotVol.IsNull())
            {
                ThreadPaintHotVol = MThread.InitThread(() =>
                {
                    GHorVolumes.CollectionCandles = Candels.AllDataPaintedCandle;
                    if (TypeHorVolume == 1)
                    {
                        if (ActiveCandles.ActiveCandle1.NotIsNull())
                        {
                            GHorVolumes.PaintHorVolEachBlock(ActiveCandles.ActiveCandle1.dataCandle.Index + 1);
                        }
                    }
                    else if (TypeHorVolume == 2 || TypeHorVolume == 3)
                    {
                        GHorVolumes.PaintHorVolByPeriodCandleDelta(false, false);
                    }
                    else if (TypeHorVolume == 5)
                    {
                        GHorVolumes.PaintHorVolByPeriodCandleDelta(false, true, limitHorVol);
                    }
                    else if (TypeHorVolume == 4)
                    {
                        GHorVolumes.PaintCollectionHVol();
                    }
                    ThreadPaintHotVol = null;
                });
            }
            ToCanvas();
        }