예제 #1
0
        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]);
            }
        }
예제 #2
0
        void Indicator_Checked(object sender, RoutedEventArgs e)
        {
            ChartTechnicalIndicator indicator = new ChartTechnicalIndicator();

            indicator.IndicatorType = IndicatorTypes.Stochastics;
            ser1.Indicators.Items.Add(indicator);
            syncChart1.Areas[0].SplitterPosition = .6;
            if (syncChart1.Areas.Count > 1)
            {
                ChartStochastics.SetLowerLineColor(ser1.Indicators.Items[ser1.Indicators.Items.Count - 1], Brushes.DarkOrchid);
                ChartStochastics.SetUpperLineColor(ser1.Indicators.Items[ser1.Indicators.Items.Count - 1], Brushes.DarkOrchid);
                ChartStochastics.SetSignalLineColor(ser1.Indicators.Items[ser1.Indicators.Items.Count - 1], Brushes.DarkOrchid);
                ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].stocasticsArea.Background = this.Resources["transparentBackground"] as SolidColorBrush;
                ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].stocasticsArea.SecondaryAxis.LineStroke            = this.Resources["linestroke"] as Pen;
                ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].stocasticsArea.SecondaryAxis.IntersectAction       = ChartLabelIntersectAction.Hide;
                ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].stocasticsArea.SecondaryAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift;
                ChartArea.SetGridLineStroke(ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].stocasticsArea.SecondaryAxis, this.Resources["gridstroke"] as Pen);
                ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].stocasticsArea.SecondaryAxis.OpposedPosition = true;
                ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].stocasticsArea.SecondaryAxis.LabelTemplate   = this.Resources["YAxistemplate"] as DataTemplate;
                for (int i = 0; i < syncChart1.Areas.Count; i++)
                {
                    SetHorizontalScale(syncChart1.Areas[i]);
                }
            }
            ChartLayer layer = new ChartLayer();

            layer.LayerIndicatorName = "Stochastics";
            layer.ParmsToParmString(defaultParams);
            ChartFastSeriesPresenter.SetPen(ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].stocasticsArea.Series[0],
                                            new Pen()
            {
                Brush = Brushes.DarkOrchid, Thickness = 2d, DashStyle = DashStyles.Dash
            });
            ChartFastSeriesPresenter.SetPen(ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].stocasticsArea.Series[1],
                                            new Pen()
            {
                Brush = Brushes.DarkOrchid, Thickness = 2d, DashStyle = DashStyles.Dash
            });
            ChartFastSeriesPresenter.SetPen(ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].stocasticsArea.Series[2],
                                            new Pen()
            {
                Brush = Brushes.DarkOrchid, Thickness = 2d, DashStyle = DashStyles.Solid
            });
            foreach (ChartSeries series in ser1.Indicators.Items[ser1.Indicators.Items.Count - 1].stocasticsArea.Series)
            {
                AddNotes(series, layer, 5);
            }
            for (int i = 0; i < syncChart1.Areas.Count; i++)
            {
                SetHorizontalScale(syncChart1.Areas[i]);
            }
        }