void Indicator_Checked(object sender, RoutedEventArgs e)
        {
            ChartTechnicalIndicator indicator = new ChartTechnicalIndicator();

            indicator.IndicatorType = IndicatorTypes.MACD;
            ser1.Indicators.Items.Add(indicator);
            syncChart1.Areas[syncChart1.Areas.Count - 1].BeginInit();
            if (syncChart1.Areas.Count > 1)
            {
                //ChartMACD.SetDivergenceLineColor(ser1.Indicators.Items[ser1.Indicators.Items.Count - 1], Brushes.Olive);
                //ChartMACD.SetConvergenceLineColor(ser1.Indicators.Items[ser1.Indicators.Items.Count - 1], Brushes.Olive);
                //ChartMACD.SetSignalLineInterior(ser1.Indicators.Items[ser1.Indicators.Items.Count - 1], Brushes.Olive);
                ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].MACDArea.Background = this.Resources["transparentBackground"] as SolidColorBrush;
                ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].MACDArea.SecondaryAxis.LineStroke            = this.Resources["linestroke"] as Pen;
                ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].MACDArea.SecondaryAxis.IntersectAction       = ChartLabelIntersectAction.Hide;
                ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].MACDArea.SecondaryAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
                ChartArea.SetGridLineStroke(ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].MACDArea.SecondaryAxis, this.Resources["gridstroke"] as Pen);
                ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].MACDArea.SecondaryAxis.OpposedPosition = true;
                ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].MACDArea.SecondaryAxis.LabelTemplate   = this.Resources["YAxistemplate"] as DataTemplate;
                ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].MACDArea.SecondaryAxis.IsAutoSetRange  = false;
                ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].MACDArea.SecondaryAxis.Range           = new DoubleRange(-15, 15);
                ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].MACDArea.SecondaryAxis.Header          = "Variation Range";
            }
            ChartFastSeriesPresenter.SetPen(ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].MACDArea.Series[0],
                                            new Pen()
            {
                Brush = Brushes.Olive, Thickness = 1d, DashStyle = DashStyles.Solid
            });
            ChartFastSeriesPresenter.SetPen(ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].MACDArea.Series[1],
                                            new Pen()
            {
                Brush = Brushes.Olive, Thickness = 2d, DashStyle = DashStyles.Solid
            });
            ChartFastSeriesPresenter.SetPen(ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].MACDArea.Series[2],
                                            new Pen()
            {
                Brush = Brushes.Olive, Thickness = 1d, DashStyle = DashStyles.Dash
            });
            syncChart1.Areas[syncChart1.Areas.Count - 1].EndInit();

            ChartLayer layer = new ChartLayer();

            layer.LayerIndicatorName = "MACD";
            layer.ParmsToParmString(defaultParams);
            foreach (ChartSeries series in ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].MACDArea.Series)
            {
                AddNotes(series, layer, 10);
            }
            for (int i = 0; i < syncChart1.Areas.Count; i++)
            {
                SetHorizontalScale(syncChart1.Areas[i]);
            }
        }
        public void AddNotes(ChartSeries series, ChartLayer layer, int position)
        {
            AnnotationsCollection annotations = new AnnotationsCollection();
            ChartSeriesAnnotation annotation  = new ChartSeriesAnnotation();

            //annotation.Header = layer.Note;
            if (layer.NoteVisibility == NoteVisibilityState.Opened)
            {
                annotation.Stroke   = new SolidColorBrush(layer.StrokeColor);
                annotation.Template = this.Resources["AnnotationTemplateText"] as DataTemplate;
            }
            else
            {
                annotation.Template = this.Resources["AnnotationTemplate"] as DataTemplate;
            }

            annotation.X = series.Data[position].X;
            annotation.Y = series.Data[position].Y;

            annotations.Items.Add(annotation);
            series.Annotations = annotations;
        }