Exemple #1
0
        private bool DrawOhlc(int offset, int top, AxisXUnit unit, Color eraseColor)
        {
            double[] dValues = null;
            bool     bCheck  = CheckBarsValue(offset, out dValues);

            if (bCheck)
            {
                int iOpen  = top + this.AxisY.ConvertValueToHeight(dValues[0]);
                int iHigh  = top + this.AxisY.ConvertValueToHeight(dValues[1]);
                int iLow   = top + this.AxisY.ConvertValueToHeight(dValues[2]);
                int iClose = top + this.AxisY.ConvertValueToHeight(dValues[3]);

                if (eraseColor != Color.Empty)
                {
                    __cGDI.FillRectangle(eraseColor, unit.LeftPoint + 1, iHigh, (unit.RightPoint - unit.LeftPoint) - 1, iLow - iHigh + 1);
                }

                bool   bOpenH  = iOpen < iClose;
                IntPtr cOldPtr = __cGDI.SelectPen((bOpenH) ? this.ChartSetting.PenStyles[1] : this.ChartSetting.PenStyles[0]);

                __cGDI.DrawLine(unit.CenterPoint, iHigh, unit.CenterPoint, iLow);
                __cGDI.DrawLine(unit.LeftPoint + 1, iOpen, unit.CenterPoint, iOpen);
                __cGDI.DrawLine(unit.CenterPoint, iClose, unit.RightPoint, iClose);
                __cGDI.RemoveObject(__cGDI.SelectPen(cOldPtr));
            }
            return(bCheck);
        }
Exemple #2
0
        public void DrawObject(Layer layer, DrawObject item)
        {
            Point[] cPoints = item.ConvertPoints(layer);
            bool    bDraw   = Boundary.BoundFix(ref cPoints[0], ref cPoints[1], new Rectangle4(layer.LayerRectangleWithoutAxisY));

            if (bDraw)
            {
                IntPtr cOldPen = __cGDI.SelectPen(item.Pens[0]);
                __cGDI.DrawLine(cPoints[0].X, cPoints[0].Y, cPoints[1].X, cPoints[1].Y);
                __cGDI.RemoveObject(__cGDI.SelectPen(cOldPen));
            }
        }
        private bool DrawClosingLine(int offset, int top, int x, int prevX, PowerLanguage.PenStyle erasePen)
        {
            double dClose = 0;
            bool   bCheck = CheckBarsValue(offset, out dClose);

            if (bCheck)
            {
                int iPrevClose    = top + this.AxisY.ConvertValueToHeight(__dPrevClose);
                int iCurrentClose = top + this.AxisY.ConvertValueToHeight(dClose);

                if (erasePen != null)
                {
                    int    iLastClose = top + this.AxisY.ConvertValueToHeight(__dLastClose);
                    IntPtr cOldPen    = __cGDI.SelectPen(erasePen);
                    __cGDI.DrawLine(prevX, iPrevClose, x, iLastClose);
                    __cGDI.SelectPen(cOldPen);
                }

                __dLastClose = dClose;
                __cGDI.DrawLine(prevX, iPrevClose, x, iCurrentClose);
            }
            return(bCheck);
        }
Exemple #4
0
        private void DrawTradeInfo(ITrade trade, AxisX axisX, ChartProperty property, IntPtr font, Rectangle4 layerRect, int top)
        {
            ITradeOrder cEntry  = trade.EntryOrder;
            Point       cPoint1 = new Point(axisX.ConvertBarNumberToWidth(cEntry.BarNumber).CenterPoint, top + this.AxisY.ConvertValueToHeight(cEntry.Price));

            __cGDI.DrawString("▸", property.TradeSymbolColor, cPoint1.X - 7, cPoint1.Y - 7);
            DrawTradeName(cEntry.Name, font, property.ForeColor, cPoint1, true);

            ITradeOrder cExit = trade.ExitOrder;

            if (cExit != null)
            {
                Point cPoint2 = new Point(axisX.ConvertBarNumberToWidth(cExit.BarNumber).CenterPoint, top + this.AxisY.ConvertValueToHeight(cExit.Price));
                __cGDI.DrawString("◂", property.TradeSymbolColor, cPoint2.X + 1, cPoint2.Y - 7);
                DrawTradeName(cExit.Name, font, property.ForeColor, cPoint2, false);

                if (Boundary.BoundFix(ref cPoint1, ref cPoint2, layerRect))
                {
                    __cGDI.DrawLine(cPoint1.X, cPoint1.Y, cPoint2.X, cPoint2.Y);
                }
            }
        }