Ejemplo n.º 1
0
        public static void drawValueString(NinjaTrader.Indicator.Indicator ind, Graphics graphics, Rectangle bounds, string plotName, int plotNum, double val, int boxNum)
        {
            string        s   = plotName + ": ";
            StringBuilder str = new StringBuilder();

            str.Append((Math.Round(val, 3)).ToString());
            Color valColor = (val > 0) ? Color.YellowGreen : Color.OrangeRed;

            textBrush.Color = valColor;
            Brush b = textBrush;

            if (plotNum == -1)
            {
                //do nothing
            }
            else if (ind.Plots[plotNum] == null)
            {
                s = "Err: Plot Does not exsit!";
            }
            else
            {
                b = (ind.Plots[plotNum].Pen.Color == Color.Transparent) ? textBrush : ind.Plots[plotNum].Pen.Brush;
            }
            graphics.DrawString(s, textFont, b, bounds.X + bounds.Width - 37, bounds.Y + bounds.Height - boxNum * 20, stringFormat);
            graphics.DrawString(str.ToString(), textFont, textBrush, bounds.X + bounds.Width - 3, bounds.Y + bounds.Height - boxNum * 20, stringFormat);
        }
Ejemplo n.º 2
0
 public void removeMarker(NinjaTrader.Indicator.Indicator i)
 {
     i.RemoveDrawObject(marker);
     marker = null;
     num    = -1;
     mtxt   = null;
 }
Ejemplo n.º 3
0
        public static int getSlope(NinjaTrader.Indicator.Indicator ind, DataSeries series, int index)
        {
            if (!series.ContainsValue(3))
            {
                return(0);
            }

            return((int)(((180 / Math.PI) * (Math.Atan((series.Get(index) - ((series.Get(index + 1) + series.Get(index + 2)) / 2)) / 1.5 / ind.TickSize))) * -1));
        }
Ejemplo n.º 4
0
        public static void drawValueString(NinjaTrader.Indicator.Indicator ind, Graphics graphics, Rectangle bounds, string plotName, int plotNum, DataSeries series, int boxNum)
        {
            int index = -1;
            int bars  = ind.CalculateOnBarClose ? (ind.ChartControl.BarsPainted - 2) : (ind.ChartControl.BarsPainted - 1);

            if (ind.Bars != null)
            {
                index = ((ind.ChartControl.LastBarPainted - ind.ChartControl.BarsPainted) - 1) + bars;
                if (ind.ChartControl.ShowBarsRequired || ((index - ind.Displacement) >= ind.BarsRequired))
                {
                    double        val = series.Get(index);
                    string        s   = plotName + ": ";
                    StringBuilder str = new StringBuilder();
                    str.Append((Math.Round(val, 3)).ToString());
                    Color valColor = (val > 0) ? Color.YellowGreen : Color.OrangeRed;
                    textBrush.Color = valColor;
                    Brush b = textBrush;
                    if (plotNum == -1)
                    {
                        //do nothing
                    }
                    else if (ind.Plots[plotNum] == null)
                    {
                        s = "Err: Plot Does not exsit!";
                    }
                    else
                    {
                        b = (ind.Plots[plotNum].Pen.Color == Color.Transparent)
                                ? textBrush
                                : ind.Plots[plotNum].Pen.Brush;
                    }
                    graphics.DrawString(s, textFont, b, bounds.X + bounds.Width - 37, bounds.Y + bounds.Height - boxNum * 20,
                                        stringFormat);
                    graphics.DrawString(str.ToString(), textFont, textBrush, bounds.X + bounds.Width - 3,
                                        bounds.Y + bounds.Height - boxNum * 20, stringFormat);
                }
            }
        }