Inheritance: IndicatorBase
Exemplo n.º 1
0
 public static int GetSlope(Indicator ind, DataSeries series, int index)
 {
     return !series.ContainsValue(3) ? 0 : (int)((57.295779513082323 * Math.Atan(((series.Get(index) - ((series.Get(index + 1) + series.Get(index + 2)) / 2.0)) / 1.5) / ind.TickSize)) * -1.0);
 }
Exemplo n.º 2
0
 public static void DrawValueString(Indicator ind, Graphics graphics, Rectangle bounds, string plotName, int plotNum, DataSeries series, int boxNum)
 {
     int num2 = ind.CalculateOnBarClose ? (ind.ChartControl.BarsPainted - 2) : (ind.ChartControl.BarsPainted - 1);
     if (ind.Bars != null)
     {
         int index = ((ind.ChartControl.LastBarPainted - ind.ChartControl.BarsPainted) - 1) + num2;
         if (ind.ChartControl.ShowBarsRequired || ((index - ind.Displacement) >= ind.BarsRequired))
         {
             double num3 = series.Get(index);
             string s = plotName + ": ";
             StringBuilder builder = new StringBuilder();
             builder.Append(Math.Round(num3, 3).ToString(CultureInfo.InvariantCulture));
             Color color = (num3 > 0.0) ? upColor : downColor;
             textBrush.Color = color;
             Brush brush = textBrush;
             if (plotNum != -1)
             {
                 if (ind.Plots[plotNum] == null)
                     s = "Err: Plot Does not exsit!";
                 else
                     brush = (ind.Plots[plotNum].Pen.Color == Color.Transparent) ? textBrush : ind.Plots[plotNum].Pen.Brush;
             }
             graphics.DrawString(s, textFont, brush, (bounds.X + bounds.Width) - 37, (bounds.Y + bounds.Height) - (boxNum * 20), stringFormat);
             graphics.DrawString(builder.ToString(), textFont, textBrush, (bounds.X + bounds.Width) - 3, (bounds.Y + bounds.Height) - (boxNum * 20), stringFormat);
         }
     }
 }
Exemplo n.º 3
0
 public static void DrawValueString(Indicator ind, Graphics graphics, Rectangle bounds, string plotName, int plotNum, double val, int boxNum)
 {
     string s = plotName + ": ";
     StringBuilder builder = new StringBuilder();
     builder.Append(Math.Round(val, 3).ToString(CultureInfo.InvariantCulture));
     Color color = (val > 0.0) ? upColor : downColor;
     textBrush.Color = color;
     Brush brush = textBrush;
     if (plotNum != -1)
     {
         if (ind.Plots[plotNum] == null)
             s = "Err: Plot Does not exsit!";
         else
             brush = (ind.Plots[plotNum].Pen.Color == Color.Transparent) ? textBrush : ind.Plots[plotNum].Pen.Brush;
     }
     graphics.DrawString(s, textFont, brush, ((bounds.X + bounds.Width) - 37), ((bounds.Y + bounds.Height) - (boxNum * 20)), stringFormat);
     graphics.DrawString(builder.ToString(), textFont, textBrush, ((bounds.X + bounds.Width) - 3), ((bounds.Y + bounds.Height) - (boxNum * 20)), stringFormat);
 }
Exemplo n.º 4
0
        public static void DrawSymbol(Indicator ind, SymbolType symbol, string tag, int barsAgo, double y, Color color)
        {
            const bool autoScale = false;
            switch (symbol)
            {
                case SymbolType.Dot:
                    ind.DrawDot(tag, autoScale, barsAgo, y, color);
                    return;

                case SymbolType.Square:
                    ind.DrawSquare(tag, autoScale, barsAgo, y, color);
                    return;

                case SymbolType.TriangleUp:
                    ind.DrawTriangleUp(tag, autoScale, barsAgo, y, color);
                    return;

                case SymbolType.TriangleDown:
                    ind.DrawTriangleDown(tag, autoScale, barsAgo, y, color);
                    return;

                case SymbolType.Diamond:
                    ind.DrawDiamond(tag, autoScale, barsAgo, y, color);
                    return;

                case SymbolType.ArrowUp:
                    ind.DrawArrowUp(tag, autoScale, barsAgo, y, color);
                    return;

                case SymbolType.ArrowDown:
                    ind.DrawArrowDown(tag, autoScale, barsAgo, y, color);
                    break;

                case SymbolType.None:
                    break;

                default:
                    return;
            }
        }