Ejemplo n.º 1
0
        /// <summary>
        /// Инициализация внутренних событий
        /// </summary>
        protected void InitNativeEvents()
        {
            System.Action <decimal, decimal, decimal> EventRefrech = (cur, max, min) =>
            {
                this.Paint();
            };
            Candels.OnReachMinMax      += EventRefrech;
            Volumes.OnReachLimitValues += EventRefrech;
            //DeltaVol.OnReachLimitValues += EventRefrech;

            Candels.OnPaintedCandle += (dCan) =>
            {
            };

            DragAndDrop.OnDrag += (first, second) =>
            {
                RightPrices.CheckDragAndDrop(DragAndDrop);
            };
            DragAndDrop.OnDrop += (first, second) =>
            {
                RightPrices.CheckDragAndDrop(DragAndDrop);
            };

            //Отрисовка свечей завершена

            /*PanelCandels.OnPaintedCandles += () =>
             * {
             *
             * };*/
            //Отрисовка свечей завершена

            /*PanelCandels.OnPaintedCandles += () =>
             * {
             *
             * };*/

            //Перед отрисовкой свечей

            /*PanelCandels.OnBeforePaintCandle += () =>
             * {
             *  this.ActiveCandle = null;
             * };
             *
             * //Отрисовка одной свечи
             * /*PanelCandels.OnPaintCandle += (candle) =>
             * {
             *
             * };*/
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 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();
        }