/// <summary>
        /// Override the Draw method to display the indicator.
        /// </summary>
        public override void Draw(MSChart.Chart chart1, bool enable = true)
        {
            string INDICATOR = "MedianPrice";

            MSChart.ChartDashStyle lineStyle = Parse.ParseEnum <MSChart.ChartDashStyle>(parameters["Line Style"].Value.ToString());
            Color indicatorColor             = (Color)parameters["Color"].Value;

            if (chart1.Series.IndexOf(INDICATOR) == -1)
            {
                chart1.Series.Add(INDICATOR);
                chart1.Series[INDICATOR].IsXValueIndexed = true;
                chart1.Series[INDICATOR].ChartType       = MSChart.SeriesChartType.Line;
            }
            else
            {
                chart1.Series[INDICATOR].Points.Clear();
            }

            chart1.Series[INDICATOR].BorderWidth     = 2;
            chart1.Series[INDICATOR].BorderDashStyle = lineStyle;
            chart1.Series[INDICATOR].Color           = indicatorColor;

            //string formulaParameters = string.Format("{0}", period);

            chart1.DataManipulator.IsStartFromFirst = true;
            // OPEN=candlestickSeries:Y HIGH=candlestickSeries:Y1 LOW=candlestickSeries:Y2 CLOSE=candlestickSeries:Y3 VOLUME=candlestickVolumeSeries:Y
            // Inputs to this indicator: High, Low
            chart1.DataManipulator.FinancialFormula(MSChart.FinancialFormula.MedianPrice, "candlestickSeries:Y1,candlestickSeries:Y2", INDICATOR + ":Y");

            RescaleAxes(chart1, "ChartAreaMain");
        }
        /// <summary>
        /// Override the Draw method to display the indicator.
        /// </summary>
        public override void Draw(MSChart.Chart chart1, bool enable = true)
        {
            string INDICATOR = "TriangularMovingAverage";

            int period = (int)parameters["Period"].Value;

            MSChart.ChartDashStyle lineStyle = Parse.ParseEnum <MSChart.ChartDashStyle>(parameters["Line Style"].Value.ToString());
            Color indicatorColor             = (Color)parameters["Color"].Value;

            if (chart1.Series.IndexOf(INDICATOR) == -1)
            {
                chart1.Series.Add(INDICATOR);
                chart1.Series[INDICATOR].IsXValueIndexed = true;
                chart1.Series[INDICATOR].ChartType       = MSChart.SeriesChartType.Line;
            }
            else
            {
                chart1.Series[INDICATOR].Points.Clear();
            }

            chart1.Series[INDICATOR].BorderWidth     = 2;
            chart1.Series[INDICATOR].BorderDashStyle = lineStyle;
            chart1.Series[INDICATOR].Color           = indicatorColor;

            string formulaParameters = string.Format("{0}", period);

            chart1.DataManipulator.IsStartFromFirst = true;
            chart1.DataManipulator.FinancialFormula(MSChart.FinancialFormula.TriangularMovingAverage, formulaParameters, "candlestickSeries:Y3", INDICATOR + ":Y");

            AlignChartData(chart1.Series["candlestickSeries"], chart1.Series[INDICATOR]);

            RescaleAxes(chart1, "ChartAreaMain");
        }
        /// <summary>
        /// Override the Draw method to display the indicator.
        /// </summary>
        public override void Draw(MSChart.Chart chart1, bool enable = true)
        {
            string EMA = "ExponentialMovingAverage";

            int emaPeriod = (int)parameters["EMAPeriod"].Value;

            MSChart.ChartDashStyle lineStyle = Parse.ParseEnum <MSChart.ChartDashStyle>(parameters["Line Style"].Value.ToString());
            Color indicatorColor             = (Color)parameters["Color"].Value;

            if (chart1.Series.IndexOf(EMA) == -1)
            {
                chart1.Series.Add(EMA);
                chart1.Series[EMA].IsXValueIndexed = true;
                chart1.Series[EMA].ChartType       = MSChart.SeriesChartType.Line;
            }
            else
            {
                chart1.Series[EMA].Points.Clear();
            }

            chart1.Series[EMA].BorderWidth     = 2;
            chart1.Series[EMA].BorderDashStyle = lineStyle;
            chart1.Series[EMA].Color           = indicatorColor;

            string emaPeriodStr = emaPeriod.ToString();

            chart1.DataManipulator.IsStartFromFirst = true;
            chart1.DataManipulator.FinancialFormula(MSChart.FinancialFormula.ExponentialMovingAverage, emaPeriodStr, "candlestickSeries:Y3", EMA + ":Y");

            AlignChartData(chart1.Series["candlestickSeries"], chart1.Series[EMA]);

            RescaleAxes(chart1, "ChartAreaMain");
        }
Exemple #4
0
        /// <summary>
        /// Override the Draw method to display the indicator.
        /// </summary>
        public override void Draw(MSChart.Chart chart1, bool enable = true)
        {
            string EU = "Envelopes_Upper";
            string EL = "Envelopes_Lower";

            int    maPeriod = (int)parameters["MAPeriod"].Value;
            double shift    = (double)parameters["Shift"].Value;

            MSChart.ChartDashStyle lineStyle = Parse.ParseEnum <MSChart.ChartDashStyle>(parameters["Line Style"].Value.ToString());
            Color indicatorColor             = (Color)parameters["Color"].Value;

            // Upper Band
            if (chart1.Series.IndexOf(EU) == -1)
            {
                chart1.Series.Add(EU);
                chart1.Series[EU].IsXValueIndexed = true;
                chart1.Series[EU].ChartType       = MSChart.SeriesChartType.Line;
            }
            else
            {
                chart1.Series[EU].Points.Clear();
            }

            chart1.Series[EU].BorderWidth     = 2;
            chart1.Series[EU].BorderDashStyle = lineStyle;
            chart1.Series[EU].Color           = indicatorColor;

            // Lower Band
            if (chart1.Series.IndexOf(EL) == -1)
            {
                chart1.Series.Add(EL);
                chart1.Series[EL].IsXValueIndexed = true;
                chart1.Series[EL].ChartType       = MSChart.SeriesChartType.Line;
            }
            else
            {
                chart1.Series[EL].Points.Clear();
            }

            chart1.Series[EL].BorderWidth     = 2;
            chart1.Series[EL].BorderDashStyle = lineStyle;
            chart1.Series[EL].Color           = indicatorColor;

            string formulaParameters = string.Format("{0},{1}", maPeriod, shift);

            chart1.DataManipulator.IsStartFromFirst = true;
            chart1.DataManipulator.FinancialFormula(MSChart.FinancialFormula.Envelopes, formulaParameters, "candlestickSeries:Y3", EU + ":Y," + EL + ":Y");

            AlignChartData(chart1.Series["candlestickSeries"], chart1.Series[EL]);
            AlignChartData(chart1.Series["candlestickSeries"], chart1.Series[EU]);

            RescaleAxes(chart1, "ChartAreaMain");
        }
        /// <summary>
        /// Override the Draw method to display the indicator.
        /// </summary>
        public override void Draw(MSChart.Chart chart1, bool enable = true)
        {
            int periodK = (int)parameters["PeriodK"].Value;
            int periodD = (int)parameters["PeriodD"].Value;

            MSChart.ChartDashStyle lineStyle = Parse.ParseEnum <MSChart.ChartDashStyle>(parameters["Line Style"].Value.ToString());
            Color indicatorColor             = (Color)parameters["Color"].Value;

            string INDICATOR = "StochasticIndicatorSimple";
            string SMOOTHED  = "StochasticIndicatorSmoothed";

            if (chart1.Series.IndexOf(INDICATOR) == -1)
            {
                chart1.Series.Add(INDICATOR);
                chart1.Series[INDICATOR].IsXValueIndexed = true;
                chart1.Series[INDICATOR].ChartType       = MSChart.SeriesChartType.Line;
                chart1.Series.Add(SMOOTHED);
                chart1.Series[SMOOTHED].IsXValueIndexed = true;
                chart1.Series[SMOOTHED].ChartType       = MSChart.SeriesChartType.Line;
            }
            else
            {
                chart1.Series[INDICATOR].Points.Clear();
                chart1.Series[SMOOTHED].Points.Clear();
            }
            chart1.Series[INDICATOR].BorderWidth     = 2;
            chart1.Series[INDICATOR].BorderDashStyle = lineStyle;
            chart1.Series[INDICATOR].Color           = indicatorColor;
            chart1.Series[SMOOTHED].BorderWidth      = 2;
            chart1.Series[SMOOTHED].BorderDashStyle  = MSChart.ChartDashStyle.Dot;
            chart1.Series[SMOOTHED].Color            = indicatorColor;

            chart1.Series[INDICATOR].ChartArea = "ChartAreaBottom";
            chart1.Series[SMOOTHED].ChartArea  = "ChartAreaBottom";

            if (enable == true)
            {
                EnableOneBottomSeries(chart1, "StochasticIndicator");
            }

            string formulaParameters = string.Format("{0},{1}", periodK, periodD);

            chart1.DataManipulator.IsStartFromFirst = true;
            // OPEN=candlestickSeries:Y HIGH=candlestickSeries:Y1 LOW=candlestickSeries:Y2 CLOSE=candlestickSeries:Y3 VOLUME=candlestickVolumeSeries:Y
            // Inputs to this indicator: High, Low, Close
            chart1.DataManipulator.FinancialFormula(MSChart.FinancialFormula.StochasticIndicator, formulaParameters, "candlestickSeries:Y1,candlestickSeries:Y2,candlestickSeries:Y3", INDICATOR + ":Y," + SMOOTHED + ":Y");

            AlignChartData(chart1.Series["candlestickSeries"], chart1.Series[INDICATOR]);
            AlignChartData(chart1.Series["candlestickSeries"], chart1.Series[SMOOTHED]);

            RescaleAxes(chart1);
        }
Exemple #6
0
        /// <summary>
        /// Override the Draw method to display the indicator.
        /// </summary>
        public override void Draw(MSChart.Chart chart1, bool enable = true)
        {
            int  regressionType = (int)parameters["RegressionType"].Value;
            int  period         = (int)parameters["Period"].Value;
            bool approxError    = (bool)parameters["ApproxError"].Value;
            bool forecastError  = (bool)parameters["ForecastError"].Value;

            MSChart.ChartDashStyle lineStyle = Parse.ParseEnum <MSChart.ChartDashStyle>(parameters["Line Style"].Value.ToString());
            Color indicatorColor             = (Color)parameters["Color"].Value;

            string INDICATOR = "Forecasting";
            string FUE       = "Forecasting Upper Error";
            string FLE       = "Forecasting Lower Error";

            if (chart1.Series.IndexOf(INDICATOR) == -1)
            {
                chart1.Series.Add(INDICATOR);
                chart1.Series[INDICATOR].IsXValueIndexed = true;
                chart1.Series[INDICATOR].ChartType       = MSChart.SeriesChartType.Line;
                chart1.Series.Add(FUE);
                chart1.Series[FUE].IsXValueIndexed = true;
                chart1.Series[FUE].ChartType       = MSChart.SeriesChartType.Line;
                chart1.Series.Add(FLE);
                chart1.Series[FLE].IsXValueIndexed = true;
                chart1.Series[FLE].ChartType       = MSChart.SeriesChartType.Line;
            }
            else
            {
                chart1.Series[INDICATOR].Points.Clear();
                chart1.Series[FUE].Points.Clear();
                chart1.Series[FLE].Points.Clear();
            }
            chart1.Series[INDICATOR].BorderWidth     = 2;
            chart1.Series[INDICATOR].BorderDashStyle = lineStyle;
            chart1.Series[INDICATOR].Color           = indicatorColor;
            chart1.Series[FUE].BorderWidth           = 1;
            chart1.Series[FUE].BorderDashStyle       = MSChart.ChartDashStyle.Dot;
            chart1.Series[FUE].Color           = indicatorColor;
            chart1.Series[FLE].BorderWidth     = 1;
            chart1.Series[FLE].BorderDashStyle = MSChart.ChartDashStyle.Dot;
            chart1.Series[FLE].Color           = indicatorColor;

            string formulaParameters = string.Format("{0},{1},{2},{3}", regressionType, period, approxError, forecastError);

            chart1.DataManipulator.IsStartFromFirst = true;
            // OPEN=candlestickSeries:Y HIGH=candlestickSeries:Y1 LOW=candlestickSeries:Y2 CLOSE=candlestickSeries:Y3 VOLUME=candlestickVolumeSeries:Y
            // Inputs to this indicator: Close
            chart1.DataManipulator.FinancialFormula(MSChart.FinancialFormula.Forecasting, formulaParameters, "candlestickSeries:Y3", INDICATOR + ":Y," + FUE + ":Y," + FLE + ":Y");
        }
        /// <summary>
        /// Override the Draw method to display the indicator.
        /// </summary>
        public override void Draw(MSChart.Chart chart1, bool enable = true)
        {
            int  periodShort   = (int)parameters["PeriodShort"].Value;
            int  periodLong    = (int)parameters["PeriodLong"].Value;
            bool usePercentage = (bool)parameters["UsePercentage"].Value;

            MSChart.ChartDashStyle lineStyle = Parse.ParseEnum <MSChart.ChartDashStyle>(parameters["Line Style"].Value.ToString());
            Color indicatorColor             = (Color)parameters["Color"].Value;

            string INDICATOR = "VolumeOscillator";

            if (chart1.Series.IndexOf(INDICATOR) == -1)
            {
                chart1.Series.Add(INDICATOR);
                chart1.Series[INDICATOR].IsXValueIndexed = true;
                chart1.Series[INDICATOR].ChartType       = MSChart.SeriesChartType.Line;
            }
            else
            {
                chart1.Series[INDICATOR].Points.Clear();
            }
            chart1.Series[INDICATOR].BorderWidth     = 2;
            chart1.Series[INDICATOR].BorderDashStyle = lineStyle;
            chart1.Series[INDICATOR].Color           = indicatorColor;

            chart1.Series[INDICATOR].ChartArea = "ChartAreaBottom";

            if (enable == true)
            {
                EnableOneBottomSeries(chart1, INDICATOR);
            }

            string formulaParameters = string.Format("{0},{1},{2}", periodShort, periodLong, usePercentage);

            chart1.DataManipulator.IsStartFromFirst = true;
            // OPEN=candlestickSeries:Y HIGH=candlestickSeries:Y1 LOW=candlestickSeries:Y2 CLOSE=candlestickSeries:Y3 VOLUME=candlestickVolumeSeries:Y
            // Inputs to this indicator: Volume
            chart1.DataManipulator.FinancialFormula(MSChart.FinancialFormula.VolumeOscillator, formulaParameters, "candlestickVolumeSeries:Y", INDICATOR + ":Y");

            AlignChartData(chart1.Series["candlestickSeries"], chart1.Series[INDICATOR]);

            RescaleAxes(chart1);
        }
Exemple #8
0
        /// <summary>
        /// Override the Draw method to display the indicator.
        /// </summary>
        public override void Draw(MSChart.Chart chart1, bool enable = true)
        {
            int shortPeriod = (int)parameters["ShortPeriod"].Value;
            int longPeriod  = (int)parameters["LongPeriod"].Value;

            MSChart.ChartDashStyle lineStyle = Parse.ParseEnum <MSChart.ChartDashStyle>(parameters["Line Style"].Value.ToString());
            Color indicatorColor             = (Color)parameters["Color"].Value;

            string INDICATOR = "MACD";

            if (chart1.Series.IndexOf(INDICATOR) == -1)
            {
                chart1.Series.Add(INDICATOR);
                chart1.Series[INDICATOR].IsXValueIndexed = true;
                chart1.Series[INDICATOR].ChartType       = MSChart.SeriesChartType.Line;
            }
            else
            {
                chart1.Series[INDICATOR].Points.Clear();
            }
            chart1.Series[INDICATOR].BorderWidth     = 2;
            chart1.Series[INDICATOR].BorderDashStyle = lineStyle;
            chart1.Series[INDICATOR].Color           = indicatorColor;

            chart1.Series[INDICATOR].ChartArea = "ChartAreaBottom";

            if (enable == true)
            {
                EnableOneBottomSeries(chart1, INDICATOR);
            }

            string formulaParameters = string.Format("{0},{1}", shortPeriod, longPeriod);

            chart1.DataManipulator.IsStartFromFirst = true;
            // OPEN=candlestickSeries:Y HIGH=candlestickSeries:Y1 LOW=candlestickSeries:Y2 CLOSE=candlestickSeries:Y3 VOLUME=candlestickVolumeSeries:Y
            // Inputs to this indicator: High, Low
            chart1.DataManipulator.FinancialFormula(MSChart.FinancialFormula.MovingAverageConvergenceDivergence, formulaParameters, "candlestickSeries:Y3", INDICATOR + ":Y");

            AlignChartData(chart1.Series["candlestickSeries"], chart1.Series[INDICATOR]);

            RescaleAxes(chart1);
        }
Exemple #9
0
        /// <summary>
        /// Override the Draw method to display the indicator.
        /// </summary>
        public override void Draw(MSChart.Chart chart1, bool enable = true)
        {
            MSChart.ChartDashStyle lineStyle = Parse.ParseEnum <MSChart.ChartDashStyle>(parameters["Line Style"].Value.ToString());
            Color indicatorColor             = (Color)parameters["Color"].Value;

            string INDICATOR = "PriceVolumeTrend";

            if (chart1.Series.IndexOf(INDICATOR) == -1)
            {
                chart1.Series.Add(INDICATOR);
                chart1.Series[INDICATOR].IsXValueIndexed = true;
                chart1.Series[INDICATOR].ChartType       = MSChart.SeriesChartType.Line;
            }
            else
            {
                chart1.Series[INDICATOR].Points.Clear();
            }
            chart1.Series[INDICATOR].BorderWidth     = 2;
            chart1.Series[INDICATOR].BorderDashStyle = lineStyle;
            chart1.Series[INDICATOR].Color           = indicatorColor;

            chart1.Series[INDICATOR].ChartArea = "ChartAreaBottom";

            if (enable == true)
            {
                EnableOneBottomSeries(chart1, INDICATOR);
            }

            //string formulaParameters = string.Format("{0}", startPVI);

            chart1.DataManipulator.IsStartFromFirst = true;
            // OPEN=candlestickSeries:Y HIGH=candlestickSeries:Y1 LOW=candlestickSeries:Y2 CLOSE=candlestickSeries:Y3 VOLUME=candlestickVolumeSeries:Y
            // Inputs to this indicator: Close, Volume
            chart1.DataManipulator.FinancialFormula(MSChart.FinancialFormula.PriceVolumeTrend, "candlestickSeries:Y3,candlestickVolumeSeries:Y", INDICATOR + ":Y");

            AlignChartData(chart1.Series["candlestickSeries"], chart1.Series[INDICATOR]);

            RescaleAxes(chart1);
        }
        public override void Draw(MSChart.Chart chart1, bool enable = true)
        {
            int    maPeriod      = (int)parameters["MAPeriod"].Value;
            int    atrPeriod     = (int)parameters["ATRPeriod"].Value;
            double atrMultiplier = (double)parameters["ATRMultiplier"].Value;

            MSChart.ChartDashStyle lineStyle = Parse.ParseEnum <MSChart.ChartDashStyle>(parameters["Line Style"].Value.ToString());
            Color indicatorColor             = (Color)parameters["Color"].Value;

            string MA = "MovingAverage";

            if (chart1.Series.IndexOf(MA) == -1)
            {
                chart1.Series.Add(MA);
                chart1.Series[MA].IsXValueIndexed = true;
                chart1.Series[MA].ChartType       = MSChart.SeriesChartType.Line;
                chart1.Series[MA].BorderWidth     = 2;
                chart1.Series[MA].BorderDashStyle = MSChart.ChartDashStyle.Dash;
                chart1.Series[MA].Color           = Color.Gray;
            }
            else
            {
                chart1.Series[MA].Points.Clear();
            }

            string ATR = "ATR";

            if (chart1.Series.IndexOf(ATR) == -1)
            {
                chart1.Series.Add(ATR);
                chart1.Series[ATR].IsXValueIndexed = true;
                chart1.Series[ATR].ChartType       = MSChart.SeriesChartType.Bar;
                chart1.Series[ATR].Enabled         = false;
            }
            else
            {
                chart1.Series[ATR].Points.Clear();
            }

            string maPeriodStr  = maPeriod.ToString();
            string atrPeriodStr = atrPeriod.ToString();

            chart1.DataManipulator.IsStartFromFirst = true;
            chart1.DataManipulator.FinancialFormula(MSChart.FinancialFormula.MovingAverage, maPeriodStr, "candlestickSeries:Y3", MA + ":Y");
            chart1.DataManipulator.IsStartFromFirst = true;
            chart1.DataManipulator.FinancialFormula(MSChart.FinancialFormula.AverageTrueRange, atrPeriodStr, "candlestickSeries:Y1,candlestickSeries:Y2,candlestickSeries:Y3", ATR + ":Y");

            string KC_LOWER = "KC_LOWER";

            if (chart1.Series.IndexOf(KC_LOWER) == -1)
            {
                chart1.Series.Add(KC_LOWER);
                chart1.Series[KC_LOWER].IsXValueIndexed = true;
                chart1.Series[KC_LOWER].ChartType       = MSChart.SeriesChartType.Line;
            }
            else
            {
                chart1.Series[KC_LOWER].Points.Clear();
            }

            chart1.Series[KC_LOWER].BorderWidth     = 2;
            chart1.Series[KC_LOWER].BorderDashStyle = lineStyle;
            chart1.Series[KC_LOWER].Color           = indicatorColor;
            chart1.Series[KC_LOWER].Enabled         = false;

            string KC_UPPER = "KC_UPPER";

            if (chart1.Series.IndexOf(KC_UPPER) == -1)
            {
                chart1.Series.Add(KC_UPPER);
                chart1.Series[KC_UPPER].IsXValueIndexed = true;
                chart1.Series[KC_UPPER].ChartType       = MSChart.SeriesChartType.Line;
            }
            else
            {
                chart1.Series[KC_UPPER].Points.Clear();
            }

            chart1.Series[KC_UPPER].BorderWidth     = 2;
            chart1.Series[KC_UPPER].BorderDashStyle = lineStyle;
            chart1.Series[KC_UPPER].Color           = indicatorColor;
            chart1.Series[KC_UPPER].Enabled         = false;

            int maPointCount   = chart1.Series[MA].Points.Count;
            int atrPointCount  = chart1.Series[ATR].Points.Count;
            int atrPointOffset = maPointCount - atrPointCount;

            for (int i = 0; i < maPointCount; i++)
            {
                double x = chart1.Series[MA].Points[i].XValue;
                double y = chart1.Series[MA].Points[i].YValues[0];
                if (i < atrPointOffset)
                {
                    chart1.Series[KC_LOWER].Points.Add(EmptyDP);
                    chart1.Series[KC_UPPER].Points.Add(EmptyDP);
                }
                else
                {
                    double atr = chart1.Series[ATR].Points[i - atrPointOffset].YValues[0];
                    chart1.Series[KC_LOWER].Points.AddXY(x, y - (atr * atrMultiplier));
                    chart1.Series[KC_UPPER].Points.AddXY(x, y + (atr * atrMultiplier));
                }
            }

            chart1.Series[KC_LOWER].Enabled = true;
            chart1.Series[KC_UPPER].Enabled = true;

            AlignChartData(chart1.Series["candlestickSeries"], chart1.Series[KC_UPPER]);
            AlignChartData(chart1.Series["candlestickSeries"], chart1.Series[KC_LOWER]);

            RescaleAxes(chart1);
        }