Example #1
0
        private void AddIndicator(Series ser, FibonacciIndicatorKind kind)
        {
            // Get a collection of indicators.
            IndicatorCollection indicators =
                ((StockSeriesView)ser.View).Indicators;

            // Clear it.
            indicators.Clear();

            // Add a new indicator to it.
            indicators.Add(CreateIndicator(kind, new DateTime(2007, 12, 27),
                                           new DateTime(2008, 1, 17), ValueLevel.High));
        }
Example #2
0
        private FibonacciIndicator CreateIndicator(FibonacciIndicatorKind kind,
                                                   DateTime arg1, DateTime arg2, ValueLevel level)
        {
            // Create the Fibonacci Indicator of the specified kind.
            FibonacciIndicator fi = new FibonacciIndicator(kind);

            // Specify its start and end points.
            fi.Point1.Argument   = arg1;
            fi.Point1.ValueLevel = level;
            fi.Point2.Argument   = arg2;
            fi.Point2.ValueLevel = level;

            // Select the name.
            switch (fi.Kind)
            {
            case FibonacciIndicatorKind.FibonacciArcs: {
                fi.Name = "Arcs";
                break;
            }

            case FibonacciIndicatorKind.FibonacciFans: {
                fi.Name = "Fans";
                break;
            }

            case FibonacciIndicatorKind.FibonacciRetracement: {
                fi.Name = "Retracement";
                break;
            }
            }

            // Make all its levels visible.
            fi.ShowLevel23_6        = true;
            fi.ShowLevel76_4        = true;
            fi.ShowLevel0           = true;
            fi.ShowLevel100         = true;
            fi.ShowAdditionalLevels = true;

            // Customize its appearance.
            fi.BaseLevelColor = Color.Green;
            fi.BaseLevelLineStyle.DashStyle = DashStyle.Dash;

            return(fi);
        }