Example #1
0
        public override void EachFullCandle(GCandles.CandleInfo toolsCandle)
        {
            if (!Enable)
            {
                return;
            }

            /*foreach (var hv in toolsCandle.Candle.GetHorVolumes().HVolCollection.ToArray())
             * {
             *  if (hv.VolBuy + hv.VolSell > MinLimitVolume)
             *  {
             *      var canvas = Panel.GetGraphics;
             *      var value = hv.VolBuy + hv.VolSell;
             *      var radius = (int)(value / CurrentTimeFrame);
             *      if (radius == 0) continue;
             *      int y = GMath.GetCoordinate(Panel.Rect.Height, Panel.Params.MaxPrice, Panel.Params.MinPrice, hv.Price);
             *      int x = GMath.GetCoordinate(toolsCandle.Body.Width, MaxHVolume, 0, value);
             *
             *      var line = new Line();
             *      if (MaxHVolume / 2 < value)
             *      {
             *          line.Width = 2.0f;
             *          line.Paint(canvas,
             *              new PointF(toolsCandle.Body.X, y),
             *              new PointF(toolsCandle.Body.X + toolsCandle.Body.Width - x, y), Color.Red);
             *      } else {
             *          line.Width = 2.0f;
             *          line.Paint(canvas,
             *              new PointF(toolsCandle.Body.X, y),
             *              new PointF(toolsCandle.Body.X + toolsCandle.Body.Width - x, y), Color.FromArgb(220, Color.Blue));
             *      }
             *  }
             * }*/
        }
Example #2
0
 public void BeforePaint()
 {
     this.Panel.Clear();
     PanelCanvas = Panel.GetGraphics;
     index       = 1;
     LastCandle  = null;
     LastX       = 0;
 }
Example #3
0
        /// <summary>
        /// Отрисовка временных линий и значений.
        /// </summary>
        /// <param name="canvas"></param>
        /// <param name="rectPaint"></param>
        public void Paint(GCandles.CandleInfo candleData)
        {
            var lineVer = new VerLine();

            //Рисуем линию разделяющую периоды или разрывы
            if (LastCandle.NotIsNull())
            {
                if (candleData.Candle.Time.AddMinutes(candleData.TimeFrame) < LastCandle.Candle.Time)
                {
                    var p1 = new PointF(LastCandle.Body.X, this.Panel.Rect.Y);
                    var p2 = new PointF(LastCandle.Body.X, this.Panel.Rect.Y + this.Panel.Rect.Height);
                    lineVer.ColorLine = Color.FromArgb(100, Color.Gray);
                    lineVer.WidthLine = 1;
                    lineVer.FillText  = true;
                    lineVer.Paint(PanelCanvas, null, p1, p2);
                }
            }
            int x = candleData.TailCoord.High.X;

            if (index == 1)
            {
                LastX = x;
            }
            if (LastX - x > PERIOD_SPLIT_LINE || index == 1)
            {
                var    p1   = new Point(x, this.Panel.Rect.Y);
                var    p2   = new Point(x, this.Panel.Rect.Y + this.Panel.Rect.Height);
                string min  = candleData.Candle.Time.Minute.ToString();
                string hour = candleData.Candle.Time.Hour.ToString();
                string time = candleData.Candle.Time.Day.ToString() + "." + candleData.Candle.Time.Month.ToString()
                              + "/" + (hour.Length < 2 ? '0' + hour : hour) + ":" + (min.Length < 2 ? '0' + min : min);
                //if (LastX - x > 70) time = candleData.Candle.Time.Day.ToString() + "/" + candleData.Candle.Time.Month.ToString() + " " + time;

                lineVer.ColorLine = this.ColorMarkLine;
                lineVer.ColorText = Color.Gray;
                lineVer.WidthLine = 1;
                lineVer.FillText  = true;
                lineVer.Paint(PanelCanvas, time, p1, p2);
                LastX = x;
            }
            LastCandle = candleData;
            if (x < 0)
            {
                return;
            }
            index++;
        }
Example #4
0
        public override void EachFullCandle(GCandles.CandleInfo toolsCandle)
        {
            if (!Enable)
            {
                return;
            }
            var canvas           = Panel.GetGraphics;
            var circleCountTrade = new Ellipse();

            circleCountTrade.Width     = 1;
            circleCountTrade.ColorLine = Color.Black;
            circleCountTrade.Fill      = true;
            circleCountTrade.FillColor = Color.Blue;
            circleCountTrade.Radius    = toolsCandle.Candle.GetCountTrades() / 100 / CurrentTimeFrame;
            circleCountTrade.PaintCircle(canvas,
                                         new PointF(toolsCandle.TailCoord.High.X - circleCountTrade.Radius,
                                                    toolsCandle.Body.Y + toolsCandle.Body.Height / 2 - circleCountTrade.Radius));
        }
Example #5
0
        public override void EachFullCandle(GCandles.CandleInfo toolsCandle)
        {
            if (!Enable)
            {
                return;
            }

            /*foreach (var hv in toolsCandle.Candle.GetHorVolumes().HVolCollection.ToArray())
             * {
             *  if (hv.CountBuy + hv.CountSell > MinLimitCount)
             *  {
             *      var canvas = Panel.GetGraphics;
             *      var value = hv.CountBuy + hv.CountSell;
             *
             *      int y = GMath.GetCoordinate(Panel.Rect.Height, Panel.Params.MaxPrice, Panel.Params.MinPrice, hv.Price);
             *      int x = GMath.GetCoordinate(toolsCandle.Body.Width, MaxCount, 0, value);
             *      float radius = (toolsCandle.Body.Width - x) / 2;
             *      if (radius == 0) continue;
             *
             *      var line = new Line();
             *      if (MaxCount / 2 < value)
             *      {
             *          line.Width = 2f;
             *          line.Paint(canvas,
             *              new PointF(toolsCandle.TailCoord.High.X - radius, y),
             *              new PointF(toolsCandle.TailCoord.High.X + radius, y), Color.Red);
             *      } else
             *      {
             *          line.Width = 2f;
             *          line.Paint(canvas,
             *              new PointF(toolsCandle.TailCoord.High.X - radius, y),
             *              new PointF(toolsCandle.TailCoord.High.X + radius, y), Color.FromArgb(220, Color.Blue));
             *      }
             *  }
             * }*/
        }
Example #6
0
        /// <summary>
        /// Проверка и создание нового уровня
        /// </summary>
        /// <param name="point"></param>
        /// <param name="candle"></param>
        protected void CheckAndCreateNewLevel(Point point, GCandles.CandleInfo candle)
        {
            if (ActiveCandles.ActiveCandle1.NotIsNull() && ActiveCandles.ActiveCandle2.NotIsNull())
            {
                if (Levels.TypeLevel == LevelsFree.TYPE_LEVELS.Vector)
                {
                    Levels.CallEventNewLevel(new LevelsFree.DoubleLevel()
                    {
                        DateLeft = new DateMarket(ActiveCandles.ActiveCandle2.dataCandle.Candle.Time),
                        Top      = GMath.GetValueFromCoordinate(Candels.Panel.Rect.Height, Candels.Panel.Params.MaxPrice, Candels.Panel.Params.MinPrice, point.Y, Candels.Panel.Params.CountFloat)
                    });
                }
                else if (Levels.TypeLevel == LevelsFree.TYPE_LEVELS.Rectangle)
                {
                    int y1 = 0, y2 = 0;
                    if (ActiveCandles.ActiveCandle1.coordClick.Y > ActiveCandles.ActiveCandle2.coordClick.Y)
                    {
                        y2 = ActiveCandles.ActiveCandle1.coordClick.Y;
                        y1 = ActiveCandles.ActiveCandle2.coordClick.Y;
                    }
                    else
                    {
                        y1 = ActiveCandles.ActiveCandle1.coordClick.Y;
                        y2 = ActiveCandles.ActiveCandle2.coordClick.Y;
                    }

                    Levels.CallEventNewLevel(new LevelsFree.DoubleLevel()
                    {
                        DateLeft  = new DateMarket(ActiveCandles.ActiveCandle1.dataCandle.Candle.Time),
                        DateRight = new DateMarket(ActiveCandles.ActiveCandle2.dataCandle.Candle.Time),
                        Top       = GMath.GetValueFromCoordinate(Candels.Panel.Rect.Height, Candels.Panel.Params.MaxPrice, Candels.Panel.Params.MinPrice, y1, Candels.Panel.Params.CountFloat),
                        Bottom    = GMath.GetValueFromCoordinate(Candels.Panel.Rect.Height, Candels.Panel.Params.MaxPrice, Candels.Panel.Params.MinPrice, y2, Candels.Panel.Params.CountFloat)
                    });
                }
            }
        }