public ATRSeries(C1FlexChart chart, string plotAreaName) : base()
        {
            Chart = chart;
            Chart.BeginUpdate();


            Axis axisY = new Axis();

            axisY.TitleStyle            = new ChartStyle();
            axisY.TitleStyle.FontWeight = FontWeights.Bold;
            axisY.Position       = C1.Chart.Position.Right;
            axisY.PlotAreaName   = plotAreaName;
            axisY.Title          = "ATR";
            axisY.Labels         = false;
            axisY.MajorTickMarks = axisY.MinorTickMarks = C1.Chart.TickMark.None;


            ATR series = new ATR();

            series.ChartType             = C1.Chart.Finance.FinancialChartType.Line;
            series.Style                 = new ChartStyle();
            series.Style.Stroke          = new SolidColorBrush(Color.FromArgb(255, 51, 103, 214));
            series.Style.Fill            = new SolidColorBrush(Color.FromArgb(128, 66, 133, 244));
            series.Style.StrokeThickness = 1;
            series.BindingX              = "Date";
            series.Binding               = "High,Low,Close";


            series.AxisY = axisY;
            Chart.Series.Add(series);


            Utilities.Helper.BindingSettingsParams(chart, series, typeof(ATR), "Average True Range (ATR)",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("Period", typeof(int)),
                new Data.PropertyParam("Style.Stroke", typeof(Brush)),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );

            //binding series color to axis title.
            Binding binding = new Binding();

            binding.Path   = new Windows.UI.Xaml.PropertyPath("Stroke");
            binding.Source = series.Style;
            BindingOperations.SetBinding(axisY.TitleStyle, ChartStyle.StrokeProperty, binding);


            Chart.EndUpdate();

            this.Series = new FinancialSeries[] { series };
        }
        public RSISeries(C1FlexChart chart, string plotAreaName) : base()
        {
            Chart = chart;
            Chart.BeginUpdate();


            AxisY.TitleStyle            = new ChartStyle();
            AxisY.TitleStyle.FontWeight = Windows.UI.Text.FontWeights.Bold;
            AxisY.Position       = C1.Chart.Position.Right;
            AxisY.PlotAreaName   = plotAreaName;
            AxisY.Title          = "RSI";
            AxisY.Labels         = false;
            AxisY.MajorTickMarks = AxisY.MinorTickMarks = C1.Chart.TickMark.None;

            RSI series = new RSI();

            series.ChartType             = C1.Chart.Finance.FinancialChartType.Line;
            series.Style                 = new ChartStyle();
            series.Style.StrokeThickness = 1;
            series.BindingX              = "Date";
            series.Binding               = "High,Low,Close";

            series.AxisY = AxisY;
            Chart.Series.Add(series);


            ThresholdSeries overBought = new ThresholdSeries();

            overBought.ChartType             = C1.Chart.Finance.FinancialChartType.Line;
            overBought.Style                 = new ChartStyle();
            overBought.Style.Stroke          = new SolidColorBrush(ViewModel.IndicatorPalettes.StockGreen);
            overBought.Style.StrokeThickness = 1;

            overBought.AxisY = AxisY;
            Chart.Series.Add(overBought);

            ThresholdSeries overSold = new ThresholdSeries();

            overSold.ChartType             = C1.Chart.Finance.FinancialChartType.Line;
            overSold.Style                 = new ChartStyle();
            overSold.Style.Stroke          = new SolidColorBrush(ViewModel.IndicatorPalettes.StockRed);
            overSold.Style.StrokeThickness = 1;

            overSold.AxisY = AxisY;
            Chart.Series.Add(overSold);


            Utilities.Helper.BindingSettingsParams(chart, series, typeof(RSI), "Relative Strength Index (RSI)",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("Period", typeof(int)),
                new Data.PropertyParam("Style.Stroke", typeof(Brush)),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );

            Utilities.Helper.BindingSettingsParams(chart, overBought, typeof(ThresholdSeries), "Relative Strength Index (RSI)",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("ZonesVisibility", typeof(bool)),
                new Data.PropertyParam("Threshold", typeof(int), "OverBought"),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );
            Utilities.Helper.BindingSettingsParams(chart, overSold, typeof(ThresholdSeries), "Relative Strength Index (RSI)",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("ZonesVisibility", typeof(bool)),
                new Data.PropertyParam("Threshold", typeof(int), "OverSold"),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );
            overBought.OnThesholdChanged += (o, e) =>
            {
                this.OnSettingParamsChanged();
            };
            overSold.OnThesholdChanged += (o, e) =>
            {
                this.OnSettingParamsChanged();
            };

            //binding series color to axis title.
            Binding binding = new Binding();

            binding.Path   = new Windows.UI.Xaml.PropertyPath("Stroke");
            binding.Source = series.Style;
            BindingOperations.SetBinding(AxisY.TitleStyle, ChartStyle.StrokeProperty, binding);

            Chart.EndUpdate();

            this.Series = new FinancialSeries[] { series, overBought, overSold };
        }
Esempio n. 3
0
        public PivotPoint(C1FlexChart chart, string plotAreaName = null) : base()
        {
            Chart = chart;
            Chart.BeginUpdate();

            if (!string.IsNullOrEmpty(plotAreaName))
            {
                this.AxisY                       = new Axis();
                this.AxisY.TitleStyle            = new ChartStyle();
                this.AxisY.TitleStyle.FontWeight = FontWeights.Bold;
                this.AxisY.Position              = C1.Chart.Position.Right;
                this.AxisY.PlotAreaName          = plotAreaName;
                this.AxisY.Title                 = "P&P";
                this.AxisY.Labels                = false;
                this.AxisY.MajorTickMarks        = this.AxisY.MinorTickMarks = C1.Chart.TickMark.None;
            }

            series                       = new PivotPointSeries();
            series.SeriesName            = "Pivot";
            series.ChartType             = C1.Chart.ChartType.Step;
            series.Style                 = new C1.WPF.Chart.ChartStyle();
            series.Style.Stroke          = new SolidColorBrush(Color.FromArgb(255, 51, 103, 214));
            series.Style.Fill            = new SolidColorBrush(Color.FromArgb(128, 66, 133, 244));
            series.Style.StrokeThickness = 1;
            series.AxisY                 = AxisY;
            Chart.Series.Add(series);

            r1                       = new R1Series();
            r1.SeriesName            = "R1";
            r1.ChartType             = C1.Chart.ChartType.Step;
            r1.Style                 = new C1.WPF.Chart.ChartStyle();
            r1.Style.Stroke          = new SolidColorBrush(Color.FromArgb(255, 51, 103, 214));
            r1.Style.Fill            = new SolidColorBrush(Color.FromArgb(128, 66, 133, 244));
            r1.Style.StrokeThickness = 1;
            r1.AxisY                 = AxisY;
            Chart.Series.Add(r1);

            r2                       = new R2Series();
            r2.SeriesName            = "R2";
            r2.ChartType             = C1.Chart.ChartType.Step;
            r2.Style                 = new C1.WPF.Chart.ChartStyle();
            r2.Style.Stroke          = new SolidColorBrush(Color.FromArgb(255, 51, 103, 214));
            r2.Style.Fill            = new SolidColorBrush(Color.FromArgb(128, 66, 133, 244));
            r2.Style.StrokeThickness = 1;
            r2.AxisY                 = AxisY;
            Chart.Series.Add(r2);

            r3                       = new R3Series();
            r3.SeriesName            = "R3";
            r3.ChartType             = C1.Chart.ChartType.Step;
            r3.Style                 = new C1.WPF.Chart.ChartStyle();
            r3.Style.Stroke          = new SolidColorBrush(Color.FromArgb(255, 51, 103, 214));
            r3.Style.Fill            = new SolidColorBrush(Color.FromArgb(128, 66, 133, 244));
            r3.Style.StrokeThickness = 1;
            r3.AxisY                 = AxisY;
            Chart.Series.Add(r3);

            s1                       = new S1Series();
            s1.SeriesName            = "S1";
            s1.ChartType             = C1.Chart.ChartType.Step;
            s1.Style                 = new C1.WPF.Chart.ChartStyle();
            s1.Style.Stroke          = new SolidColorBrush(Color.FromArgb(255, 51, 103, 214));
            s1.Style.Fill            = new SolidColorBrush(Color.FromArgb(128, 66, 133, 244));
            s1.Style.StrokeThickness = 1;
            s1.AxisY                 = AxisY;
            Chart.Series.Add(s1);

            s2                       = new S2Series();
            s2.SeriesName            = "S2";
            s2.ChartType             = C1.Chart.ChartType.Step;
            s2.Style                 = new C1.WPF.Chart.ChartStyle();
            s2.Style.Stroke          = new SolidColorBrush(Color.FromArgb(255, 51, 103, 214));
            s2.Style.Fill            = new SolidColorBrush(Color.FromArgb(128, 66, 133, 244));
            s2.Style.StrokeThickness = 1;
            s2.AxisY                 = AxisY;
            Chart.Series.Add(s2);

            s3                       = new S3Series();
            s3.SeriesName            = "S3";
            s3.ChartType             = C1.Chart.ChartType.Step;
            s3.Style                 = new C1.WPF.Chart.ChartStyle();
            s3.Style.Stroke          = new SolidColorBrush(Color.FromArgb(255, 51, 103, 214));
            s3.Style.Fill            = new SolidColorBrush(Color.FromArgb(128, 66, 133, 244));
            s3.Style.StrokeThickness = 1;
            s3.AxisY                 = AxisY;
            Chart.Series.Add(s3);


            Utilities.Helper.BindingSettingsParams(chart, this, typeof(PivotPoint), "Pivot Point",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("PivotType", typeof(PivotPointType)),
            },
                                                   () =>
            {
                PivotPointCalculator.Instance.Create();
                this.OnSettingParamsChanged();
            }
                                                   );

            Utilities.Helper.BindingSettingsParams(chart, series, typeof(PivotPointSeries), "Pivot Point",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("Style.Stroke", typeof(Brush), "Pivot"),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );
            Utilities.Helper.BindingSettingsParams(chart, r1, typeof(PivotPointSeries), "Pivot Point",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("Style.Stroke", typeof(Brush), "R1"),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );
            Utilities.Helper.BindingSettingsParams(chart, r2, typeof(PivotPointSeries), "Pivot Point",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("Style.Stroke", typeof(Brush), "R2"),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );
            Utilities.Helper.BindingSettingsParams(chart, r3, typeof(PivotPointSeries), "Pivot Point",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("Style.Stroke", typeof(Brush), "R3"),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );

            Utilities.Helper.BindingSettingsParams(chart, s1, typeof(PivotPointSeries), "Pivot Point",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("Style.Stroke", typeof(Brush), "S1"),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );
            Utilities.Helper.BindingSettingsParams(chart, s2, typeof(PivotPointSeries), "Pivot Point",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("Style.Stroke", typeof(Brush), "S2"),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );
            Utilities.Helper.BindingSettingsParams(chart, s3, typeof(PivotPointSeries), "Pivot Point",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("Style.Stroke", typeof(Brush), "S3"),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );

            if (this.AxisY != null && this.AxisY.TitleStyle != null)
            {
                //binding series color to axis title.
                Binding binding = new Binding("Stroke");
                binding.Source = series.Style;
                BindingOperations.SetBinding(AxisY.TitleStyle, ChartStyle.StrokeProperty, binding);
            }

            Object.Quote quote = ViewModel.ViewModel.Instance.CurrectQuote;
            if (quote != null)
            {
                PivotPointCalculator.Instance.Source = quote.Data;
            }
            if (series != null)
            {
                series.Calculator = PivotPointCalculator.Instance;
            }
            if (r1 != null)
            {
                r1.Calculator = PivotPointCalculator.Instance;
            }
            if (r2 != null)
            {
                r2.Calculator = PivotPointCalculator.Instance;
            }
            if (r3 != null)
            {
                r3.Calculator = PivotPointCalculator.Instance;
            }
            if (s1 != null)
            {
                s1.Calculator = PivotPointCalculator.Instance;
            }
            if (s2 != null)
            {
                s2.Calculator = PivotPointCalculator.Instance;
            }
            if (s3 != null)
            {
                s3.Calculator = PivotPointCalculator.Instance;
            }

            ViewModel.ViewModel.Instance.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == "CurrectQuote")
                {
                    quote = ViewModel.ViewModel.Instance.CurrectQuote;
                    PivotPointCalculator.Instance.Source = quote.Data;
                }
            };

            Chart.EndUpdate();

            this.Series = new Series[] { series, r1, r2, r3, s1, s2, s3 };
        }
Esempio n. 4
0
        public ADX(C1FlexChart chart, string plotAreaName) : base()
        {
            Chart = chart;
            Chart.BeginUpdate();

            AxisY.TitleStyle            = new ChartStyle();
            AxisY.TitleStyle.FontWeight = FontWeights.Bold;
            AxisY.Position       = C1.Chart.Position.Right;
            AxisY.PlotAreaName   = plotAreaName;
            AxisY.Title          = "ADX";
            AxisY.Labels         = false;
            AxisY.MajorTickMarks = AxisY.MinorTickMarks = C1.Chart.TickMark.None;


            DIPSeries dip = new DIPSeries();

            dip.ChartType             = C1.Chart.Finance.FinancialChartType.Line;
            dip.Style                 = new C1.WPF.Chart.ChartStyle();
            dip.Style.Stroke          = new SolidColorBrush(Color.FromArgb(255, 51, 103, 214));
            dip.Style.Fill            = new SolidColorBrush(Color.FromArgb(128, 66, 133, 244));
            dip.Style.StrokeThickness = 1;
            //dip.BindingX = "Date";
            //dip.Binding = "High,Low,Close";
            dip.AxisY = AxisY;
            Chart.Series.Add(dip);

            DINSeries din = new DINSeries();

            din.ChartType             = C1.Chart.Finance.FinancialChartType.Line;
            din.Style                 = new C1.WPF.Chart.ChartStyle();
            din.Style.Stroke          = new SolidColorBrush(Color.FromArgb(255, 51, 103, 214));
            din.Style.Fill            = new SolidColorBrush(Color.FromArgb(128, 66, 133, 244));
            din.Style.StrokeThickness = 1;
            //din.BindingX = "Date";
            //din.Binding = "High,Low,Close";
            din.AxisY = AxisY;
            Chart.Series.Add(din);

            ADXSeries adx = new ADXSeries();

            adx.ChartType             = C1.Chart.Finance.FinancialChartType.Line;
            adx.Style                 = new C1.WPF.Chart.ChartStyle();
            adx.Style.Stroke          = new SolidColorBrush(ViewModel.IndicatorPalettes.DefaultBorder);
            adx.Style.StrokeThickness = 1;
            //adx.BindingX = "Date";
            //adx.Binding = "High,Low,Close";
            adx.AxisY = AxisY;
            Chart.Series.Add(adx);



            Utilities.Helper.BindingSettingsParams(chart, dip, typeof(DIPSeries), "Average Directional Index (ADX)",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("Period", typeof(int)),
                new Data.PropertyParam("Style.Stroke", typeof(Brush), "D+"),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );
            Utilities.Helper.BindingSettingsParams(chart, din, typeof(DINSeries), "Average Directional Index (ADX)",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("Period", typeof(int)),
                new Data.PropertyParam("Style.Stroke", typeof(Brush), "D-"),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );
            Utilities.Helper.BindingSettingsParams(chart, adx, typeof(ADXSeries), "Average Directional Index (ADX)",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("Period", typeof(int)),
                new Data.PropertyParam("Style.Stroke", typeof(Brush), "ADX"),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );

            //binding series color to axis title.
            Binding binding = new Binding("Stroke");

            binding.Source = adx.Style;
            BindingOperations.SetBinding(AxisY.TitleStyle, ChartStyle.StrokeProperty, binding);


            Chart.EndUpdate();

            this.Series = new FinancialSeries[] { dip, din, adx };



            Object.Quote quote = ViewModel.ViewModel.Instance.CurrectQuote;
            if (quote != null)
            {
                ADXCalculator.Instance.Source = quote.Data;
            }
            if (dip != null)
            {
                dip.Calculator = ADXCalculator.Instance;
            }
            if (din != null)
            {
                din.Calculator = ADXCalculator.Instance;
            }
            if (adx != null)
            {
                adx.Calculator = ADXCalculator.Instance;
            }

            ViewModel.ViewModel.Instance.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == "CurrectQuote")
                {
                    quote = ViewModel.ViewModel.Instance.CurrectQuote;
                    ADXCalculator.Instance.Source = quote.Data;
                }
            };
        }
Esempio n. 5
0
        public MacdSeries(C1FlexChart chart, string plotAreaName) : base()
        {
            Chart = chart;
            Chart.BeginUpdate();

            AxisY.TitleStyle            = new ChartStyle();
            AxisY.TitleStyle.FontWeight = FontWeights.Bold;
            AxisY.Position       = C1.Chart.Position.Right;
            AxisY.PlotAreaName   = plotAreaName;
            AxisY.Title          = "MACD";
            AxisY.Labels         = false;
            AxisY.MajorTickMarks = AxisY.MinorTickMarks = C1.Chart.TickMark.None;


            Macd series = new Macd();

            series.MacdLineStyle = new ChartStyle();
            series.MacdLineStyle.StrokeThickness = 1;
            series.SignalLineStyle = new ChartStyle();
            series.SignalLineStyle.StrokeThickness = 1;
            series.ChartType             = C1.Chart.Finance.FinancialChartType.Line;
            series.Style                 = new C1.WPF.Chart.ChartStyle();
            series.Style.StrokeThickness = 1;
            series.BindingX              = "Date";
            series.Binding               = "High,Low,Close";

            series.AxisY = AxisY;
            Chart.Series.Add(series);



            MacdHistogram histogram = new MacdHistogram();

            histogram.Style = new C1.WPF.Chart.ChartStyle();
            histogram.Style.StrokeThickness = 1;
            histogram.BindingX = "Date";
            histogram.Binding  = "High,Low,Close";


            double[] values = null;
            ViewModel.ViewModel.Instance.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == "CurrectQuote")
                {
                    values = histogram.GetValues(0); // this is the value;
                }
            };

            histogram.SymbolRendering += (sender, ev) =>
            {
                if (values == null)
                {
                    values = histogram.GetValues(0); // this is the volume value;
                }
                if (values != null)
                {
                    if (values[ev.Index] > 0)
                    {
                        if (IncreasingBar is SolidColorBrush)
                        {
                            Color c  = (IncreasingBar as SolidColorBrush).Color;
                            Color cf = Color.FromArgb(128, c.R, c.G, c.B);
                            ev.Engine.SetStroke(c.ToArgb());
                            ev.Engine.SetFill(cf.ToArgb());
                        }
                    }
                    else
                    {
                        if (DecreasingBar is SolidColorBrush)
                        {
                            Color c  = (DecreasingBar as SolidColorBrush).Color;
                            Color cf = Color.FromArgb(128, c.R, c.G, c.B);
                            ev.Engine.SetStroke(c.ToArgb());
                            ev.Engine.SetFill(cf.ToArgb());
                        }
                    }
                }
            };

            histogram.AxisY = AxisY;
            Chart.Series.Add(histogram);



            Utilities.Helper.BindingSettingsParams(chart, series, typeof(Macd), "MACD",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("FastPeriod", typeof(int)),
                new Data.PropertyParam("SlowPeriod", typeof(int)),
                new Data.PropertyParam("SmoothingPeriod", typeof(int)),
                new Data.PropertyParam("MacdLineStyle.Stroke", typeof(Brush), "Series"),
                new Data.PropertyParam("SignalLineStyle.Stroke", typeof(Brush), "Series"),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );

            //Utilities.Helper.BindingSettingsParams(chart, histogram, typeof(MacdHistogram), "MACD",
            //    new Data.PropertyParam[]
            //    {
            //        new Data.PropertyParam("Style.Stroke", typeof(Brush), "Histogram"),
            //        new Data.PropertyParam("Style.Fill", typeof(Brush), "Histogram"),
            //    },
            //    () =>
            //    {
            //        this.OnSettingParamsChanged();
            //    }
            //);

            Utilities.Helper.BindingSettingsParams(chart, this, typeof(MacdSeries), "MACD",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("IncreasingBar", typeof(Brush)),
                new Data.PropertyParam("DecreasingBar", typeof(Brush)),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );

            //binding series color to axis title.
            Binding binding = new Binding("Stroke");

            binding.Source = series.MacdLineStyle;
            BindingOperations.SetBinding(AxisY.TitleStyle, ChartStyle.StrokeProperty, binding);

            Chart.EndUpdate();

            this.Series = new FinancialSeries[] { series, histogram };
        }
Esempio n. 6
0
        public StochasticSeries(C1FlexChart chart, string plotAreaName) : base()
        {
            Chart = chart;
            Chart.BeginUpdate();

            AxisY.TitleStyle            = new ChartStyle();
            AxisY.TitleStyle.FontWeight = FontWeights.Bold;
            AxisY.Position       = C1.Chart.Position.Right;
            AxisY.PlotAreaName   = plotAreaName;
            AxisY.Title          = "Stoc";
            AxisY.Labels         = false;
            AxisY.MajorTickMarks = AxisY.MinorTickMarks = C1.Chart.TickMark.None;

            series            = new Stochastic();
            series.DLineStyle = new ChartStyle();
            series.DLineStyle.StrokeThickness = 1;
            series.KLineStyle = new ChartStyle();
            series.KLineStyle.StrokeThickness = 1;
            series.ChartType             = C1.Chart.Finance.FinancialChartType.Line;
            series.Style                 = new C1.WPF.Chart.ChartStyle();
            series.Style.Stroke          = new SolidColorBrush(Color.FromArgb(255, 51, 103, 214));
            series.Style.Fill            = new SolidColorBrush(Color.FromArgb(128, 66, 133, 244));
            series.Style.StrokeThickness = 1;
            series.BindingX              = "Date";
            series.Binding               = "High,Low,Close";


            series.AxisY = AxisY;
            Chart.Series.Add(series);



            ThresholdSeries overBought = new ThresholdSeries();

            overBought.ChartType             = C1.Chart.Finance.FinancialChartType.Line;
            overBought.Style                 = new C1.WPF.Chart.ChartStyle();
            overBought.Style.Stroke          = new SolidColorBrush(ViewModel.IndicatorPalettes.StockGreen);
            overBought.Style.StrokeThickness = 1;

            overBought.AxisY = AxisY;
            Chart.Series.Add(overBought);

            ThresholdSeries overSold = new ThresholdSeries();

            overSold.ChartType             = C1.Chart.Finance.FinancialChartType.Line;
            overSold.Style                 = new C1.WPF.Chart.ChartStyle();
            overSold.Style.Stroke          = new SolidColorBrush(ViewModel.IndicatorPalettes.StockRed);
            overSold.Style.StrokeThickness = 1;

            overSold.AxisY = AxisY;
            Chart.Series.Add(overSold);


            Utilities.Helper.BindingSettingsParams(chart, this, typeof(StochasticSeries), "Stochastic",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("StochasticType", typeof(StochasticPresetType)),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );

            Utilities.Helper.BindingSettingsParams(chart, series, typeof(Stochastic), "Stochastic",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("KPeriod", typeof(int)),
                new Data.PropertyParam("DPeriod", typeof(int)),
                new Data.PropertyParam("SmoothingPeriod", typeof(int)),
                new Data.PropertyParam("DLineStyle.Stroke", typeof(Brush)),
                new Data.PropertyParam("KLineStyle.Stroke", typeof(Brush)),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );


            Utilities.Helper.BindingSettingsParams(chart, overBought, typeof(ThresholdSeries), "Stochastic",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("ZonesVisibility", typeof(bool)),
                new Data.PropertyParam("Threshold", typeof(int), "OverBought"),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );
            Utilities.Helper.BindingSettingsParams(chart, overSold, typeof(ThresholdSeries), "Stochastic",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("ZonesVisibility", typeof(bool)),
                new Data.PropertyParam("Threshold", typeof(int), "OverSold"),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );
            overBought.OnThesholdChanged += (o, e) =>
            {
                this.OnSettingParamsChanged();
            };
            overSold.OnThesholdChanged += (o, e) =>
            {
                this.OnSettingParamsChanged();
            };

            //binding series color to axis title.
            Binding binding = new Binding("Stroke");

            binding.Source = series.Style;
            BindingOperations.SetBinding(AxisY.TitleStyle, ChartStyle.StrokeProperty, binding);

            Chart.EndUpdate();

            this.Series = new FinancialSeries[] { series, overBought, overSold };
        }
        public MassIndex(C1FlexChart chart, string plotAreaName) : base()
        {
            Chart = chart;
            Chart.BeginUpdate();

            AxisY.TitleStyle            = new ChartStyle();
            AxisY.TitleStyle.FontWeight = FontWeights.Bold;
            AxisY.Position       = C1.Chart.Position.Right;
            AxisY.PlotAreaName   = plotAreaName;
            AxisY.Title          = "MI";
            AxisY.Labels         = false;
            AxisY.MajorTickMarks = AxisY.MinorTickMarks = C1.Chart.TickMark.None;


            series                       = new MassIndexSeries();
            series.ChartType             = C1.Chart.ChartType.Line;
            series.Style                 = new ChartStyle();
            series.Style.Stroke          = new SolidColorBrush(Color.FromArgb(255, 51, 103, 214));
            series.Style.Fill            = new SolidColorBrush(Color.FromArgb(128, 66, 133, 244));
            series.Style.StrokeThickness = 1;
            //dip.BindingX = "Date";
            //dip.Binding = "High,Low,Close";
            series.AxisY = AxisY;
            Chart.Series.Add(series);

            seriesThreshold                       = new IndicatorSeries.ThresholdSeries();
            seriesThreshold.ChartType             = C1.Chart.Finance.FinancialChartType.Line;
            seriesThreshold.Style                 = new ChartStyle();
            seriesThreshold.Style.Stroke          = new SolidColorBrush(ViewModel.IndicatorPalettes.StockGreen);
            seriesThreshold.Style.Fill            = new SolidColorBrush(Color.FromArgb(128, 66, 133, 244));
            seriesThreshold.Style.StrokeThickness = 1;
            seriesThreshold.AxisY                 = AxisY;
            Chart.Series.Add(seriesThreshold);


            Utilities.Helper.BindingSettingsParams(chart, series, typeof(MassIndexSeries), "Mass Index",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("Period", typeof(int)),
                new Data.PropertyParam("Style.Stroke", typeof(Brush)),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );

            Utilities.Helper.BindingSettingsParams(chart, seriesThreshold, typeof(IndicatorSeries.ThresholdSeries), "Mass Index",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("Threshold", typeof(Object.Threshold)),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );

            seriesThreshold.OnThesholdChanged += (o, e) =>
            {
                this.OnSettingParamsChanged();
            };

            //binding series color to axis title.
            Binding binding = new Binding();

            binding.Path   = new Windows.UI.Xaml.PropertyPath("Stroke");
            binding.Source = series.Style;
            BindingOperations.SetBinding(AxisY.TitleStyle, ChartStyle.StrokeProperty, binding);



            Object.Quote quote = ViewModel.ViewModel.Instance.CurrectQuote;
            if (quote != null)
            {
                MassIndexCalculator.Instance.Source = quote.Data;
            }

            series.Calculator = MassIndexCalculator.Instance;
            MassIndexCalculator.Instance.Period = series.Period;

            ViewModel.ViewModel.Instance.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == "CurrectQuote")
                {
                    quote = ViewModel.ViewModel.Instance.CurrectQuote;
                    MassIndexCalculator.Instance.Source = quote.Data;
                }
            };

            Chart.EndUpdate();

            this.Series = new Series[] { series, seriesThreshold };
        }
        public VolumeSeries(C1FlexChart chart, string plotAreaName) : base()
        {
            Chart = chart;
            Chart.BeginUpdate();

            AxisY.TitleStyle            = new ChartStyle();
            AxisY.TitleStyle.FontWeight = FontWeights.Bold;
            AxisY.Position       = C1.Chart.Position.Right;
            AxisY.PlotAreaName   = plotAreaName;
            AxisY.Title          = "Vol";
            AxisY.Labels         = false;
            AxisY.MajorTickMarks = AxisY.MinorTickMarks = C1.Chart.TickMark.None;

            FinancialSeries series = new FinancialSeries();

            series.ChartType             = C1.Chart.Finance.FinancialChartType.ColumnVolume;
            series.Style                 = new C1.WPF.Chart.ChartStyle();
            series.Style.Stroke          = new SolidColorBrush(Color.FromArgb(255, 51, 103, 214));
            series.Style.Fill            = new SolidColorBrush(Color.FromArgb(128, 66, 133, 244));
            series.Style.StrokeThickness = 1;
            series.BindingX              = "Date";
            series.Binding               = "Volume,Close";


            double[] values = null;
            ViewModel.ViewModel.Instance.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == "CurrectQuote")
                {
                    values = series.GetValues(2); // this is the closing value;
                }
            };
            series.SymbolRendering += (sender, ev) =>
            {
                if (ev.Index == 0)
                {
                    return;
                }
                if (values == null)
                {
                    values = series.GetValues(2); // this is the closing value;
                }
                if (values != null)
                {
                    if (values[ev.Index - 1] > values[ev.Index])
                    {
                        if (DownVolume is SolidColorBrush)
                        {
                            Color c  = (DownVolume as SolidColorBrush).Color;
                            Color cf = Color.FromArgb(128, c.R, c.G, c.B);
                            ev.Engine.SetStroke(c.ToArgb());
                            ev.Engine.SetFill(cf.ToArgb());
                        }
                    }
                    else
                    {
                        if (UpVolume is SolidColorBrush)
                        {
                            Color c  = (UpVolume as SolidColorBrush).Color;
                            Color cf = Color.FromArgb(128, c.R, c.G, c.B);
                            ev.Engine.SetStroke(c.ToArgb());
                            ev.Engine.SetFill(cf.ToArgb());
                        }
                    }
                }
            };


            series.AxisY = AxisY;
            Chart.Series.Add(series);


            //Utilities.Helper.BindingSettingsParams(chart, series, typeof(FinancialSeries), "Volume",
            //    new Data.PropertyParam[]
            //    {
            //        new Data.PropertyParam("Style.Fill", typeof(Brush)),
            //        new Data.PropertyParam("Style.Stroke", typeof(Brush)),
            //    },
            //    () =>
            //    {
            //        this.OnSettingParamsChanged();
            //    }
            //);

            Utilities.Helper.BindingSettingsParams(chart, this, typeof(VolumeSeries), "Volume",
                                                   new Data.PropertyParam[]
            {
                new Data.PropertyParam("UpVolume", typeof(Brush)),
                new Data.PropertyParam("DownVolume", typeof(Brush)),
            },
                                                   () =>
            {
                this.OnSettingParamsChanged();
            }
                                                   );

            //binding series color to axis title.
            Binding binding = new Binding("UpVolume");

            binding.Source = this;
            BindingOperations.SetBinding(AxisY.TitleStyle, ChartStyle.StrokeProperty, binding);

            Chart.EndUpdate();

            this.Series = new FinancialSeries[] { series };
        }