protected override void OnStartUp()
		{
			BMACD=MACD(Input,fast,slow,bandPeriod);
			SDBB=StdDev(BMACD,bandPeriod);

			Plots[0].Pen.Width		= DotSize;
			Plots[0].Pen.DashStyle	= DashStyle.Dot;
			Plots[1].Pen.Width		= DotSize + 1;
			Plots[1].Pen.DashStyle	= DashStyle.Dot;
			Plots[2].Pen.Width		= plot2Width;
			Plots[2].Pen.DashStyle	= dash2Style;
			Plots[3].Pen.Width		= plot3Width;
			Plots[3].Pen.DashStyle	= dash3Style;
			Plots[4].Pen.Width		= plot3Width;
			Plots[4].Pen.DashStyle	= dash3Style;
			Plots[5].Pen.Width		= plot5Width;
			Plots[5].Pen.DashStyle	= dash5Style;
			Plots[6].Pen.Width		= CrossSize;
			Plots[7].Pen.Width		= plot7Width;

			Plots[1].Pen.Color = DotsRim;
			Plots[2].Pen.Color = BBAverage;
			Plots[3].Pen.Color = BBUpper;
			Plots[4].Pen.Color = BBLower;
			Plots[6].Pen.Color = ZeroCross;
			Plots[7].Pen.Color = Connector;
		}
Beispiel #2
0
        protected double DoMCAD()
        {
            MACD _macd = MACD(MACDFastMA, MACDSlowMA, MACDSignalMA);

            PlotMACD.Set(_macd[0]);

            // 5 avg
            Values[5].Set(_macd.Avg[0]);

            // 6 diff = histogram
            Values[6].Set(_macd.Diff[0]);


            // cross signal

            // cross SMA

            return(0);
        }
        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
            if (CurrentBar < 2)
            {
                MACD.Set(0);
                Smooth.Set(0);
                Hist.Set(0);
                return;
            }

            MACD.Set(fast[0] - slow[0]);
            Smooth.Set(Smooth[1] + 0.25 * (MACD[0] - Smooth[1]));
            Hist.Set(MACD[0] - Smooth[0]);
            if ((Hist[0] > Hist[1]) ||
                ((Hist[0] == Hist[1]) && (Hist[1] > Hist[2])))
            {
                PlotColors[2][0] = Color.MidnightBlue;
            }
        }
        /// <summary>
        /// Calculates the indicator value(s) at the current index.
        /// </summary>
        protected override void OnBarUpdate()
        {
            if (!init)
            {
                BMACD   = MACD(Input, fast, slow, smooth);
                EMAMACD = EMA(BMACD, bandperiod);
                HMAMACD = HMA(BMACD, smooth);
                SDBB    = StdDev(BMACD, bandperiod);
            }
            init = true;
            double macdValue = HMAMACD[0];            //BMACD[0];

            BBMACD.Set(macdValue);
            BBMACDLine.Set(macdValue);
            BBMACDFrame.Set(macdValue);

            //double avg = EMA(BBMACD,bandperiod)[0];
            double avg = EMAMACD[0];

            Average.Set(avg);
            ZeroLine.Set(0);

            //double stdDevValue = StdDev(BBMACD,bandperiod)[0];
            double stdDevValue = SDBB[0];

            Upper.Set(avg + StdDevNumber * stdDevValue);
            Lower.Set(avg - StdDevNumber * stdDevValue);


//			if(Rising(Average))
//				if(paintbars)
//				{
//					BarColor = bbAverageUp;
//					CandleOutlineColor = candleoutlinecolorup;
//				}
//			if(Falling(Average))
//				if(paintbars)
//				{
//					BarColor = bbAverageDn;
//					CandleOutlineColor = candleoutlinecolorup;
//				}

            if (Rising(BBMACD))
            {
                if (BBMACD[0] < Upper[0])
                {
                    PlotColors[0][0] = DotsUpInside;
                    if (showhistogram)
                    {
                        Hist.Set((macdValue - avg));
                        PlotColors[10][0] = DotsUpInside;
                    }
                    updotdrawn = false;                                                 // added by TheWizard March 15, 2011
                }
                else
                {
                    PlotColors[0][0] = DotsUpOutside;
                    if (showhistogram)
                    {
                        Hist.Set((macdValue - avg));
                        PlotColors[10][0] = DotsUpOutside;
                    }
                    if (drawDotOnPricePanel)                                                                          // added by TheWizard March 15, 2011
                    {
                        if (updotdrawn == false)                                                                      // added by TheWizard March 15, 2011
                        {
                            DrawDot("UpDots" + CurrentBar, true, 0, Low[0] - dotSeparation * TickSize, BBdotUpColor); // added by TheWizard March 15, 2011
                            DrawDot("UpDots2" + CurrentBar, true, 0, Low[0] - dotSeparation * (TickSize * 2), BBdotUpColor);
                            updotdrawn   = true;                                                                      // added by TheWizard March 15, 2011
                            downdotdrawn = false;                                                                     // added by TheWizard March 15, 2011
                            if (bbviolationsound)
                            {
                                if (FirstTickOfBar)
                                {
                                    PlaySound(bbviolationupsound);
                                }
                            }
                        }
                    }
                }
                if (paintbars)
                {
                    BarColor           = barcolorup;
                    CandleOutlineColor = candleoutlinecolorup;
                }
            }
            else
            {
                if (BBMACD[0] > Lower[0])
                {
                    PlotColors[0][0] = DotsDownInside;
                    if (showhistogram)
                    {
                        Hist.Set((macdValue - avg));
                        PlotColors[10][0] = DotsDownInside;
                    }
                    downdotdrawn = false;                                       // added by TheWizard March 15, 2011
                }
                else
                {
                    PlotColors[0][0] = DotsDownOutside;
                    if (showhistogram)
                    {
                        Hist.Set((macdValue - avg));
                        PlotColors[10][0] = DotsDownOutside;
                    }
                    if (drawDotOnPricePanel)                                                                           // added by TheWizard March 15, 2011
                    {
                        if (downdotdrawn == false)                                                                     // added by TheWizard March 15, 2011
                        {
                            DrawDot("DnDots" + CurrentBar, true, 0, High[0] + dotSeparation * TickSize, BBdotDnColor); // added by TheWizard March 15, 2011
                            DrawDot("DnDots2" + CurrentBar, true, 0, High[0] + dotSeparation * (TickSize * 2), BBdotDnColor);
                            downdotdrawn = true;                                                                       // added by TheWizard March 15, 2011
                            updotdrawn   = false;                                                                      // added by TheWizard March 15, 2011
                            if (bbviolationsound)
                            {
                                if (FirstTickOfBar)
                                {
                                    PlaySound(bbviolationdnsound);
                                }
                            }
                        }
                    }
                }
                if (paintbars)
                {
                    BarColor           = barcolordn;
                    CandleOutlineColor = candleoutlinecolordn;
                }
            }
            if (BBMACD[0] > avg)
            {
                if (conservative)
                {
                    PlotColors[2][0] = BBAverageUp;
                    if (BBMACD[0] > 0)
                    {
                        PlotColors[5][0] = ZeroPositive;
                    }
                    if (BBMACD[0] < 0)
                    {
                        PlotColors[5][0] = ZeroNegative;
                    }
                }
                else
                {
                    PlotColors[2][0] = BBAverageUp;
                    PlotColors[5][0] = ZeroPositive;
                    if (colorbackground)
                    {
                        BackColor = Color.FromArgb(opacity, backgroundcolorUp);
                    }
                    if (colorALLbackgrounds)
                    {
                        BackColorAll = Color.FromArgb(opacity, backgroundcolorUp);
                    }
                }
            }

            if (BBMACD[0] < avg)
            {
                if (conservative)
                {
                    PlotColors[2][0] = BBAverageDn;
                    if (BBMACD[0] > 0)
                    {
                        PlotColors[5][0] = ZeroPositive;
                    }
                    if (BBMACD[0] < 0)
                    {
                        PlotColors[5][0] = ZeroNegative;
                    }
                }
                else
                {
                    PlotColors[2][0] = BBAverageDn;
                    PlotColors[5][0] = ZeroNegative;
                    if (colorbackground)
                    {
                        BackColor = Color.FromArgb(opacity, backgroundcolorDn);
                    }
                    if (colorALLbackgrounds)
                    {
                        BackColorAll = Color.FromArgb(opacity, backgroundcolorDn);
                    }
                }
            }

            //PlotColors[2][0] = BBAverage;
            PlotColors[3][0] = BBUpper;
            PlotColors[4][0] = BBLower;
            PlotColors[6][0] = ZeroCross;
            PlotColors[7][0] = Connector;

            if (BBMACD[0] > 0)
            {
                if (conservative)
                {
                    if (colorbackground)
                    {
                        BackColor = Color.FromArgb(opacity, backgroundcolorUp);
                    }
                    if (colorALLbackgrounds)
                    {
                        BackColorAll = Color.FromArgb(opacity, backgroundcolorUp);
                    }
                }
                if (CurrentBar != 0 && BBMACD[1] <= 0)
                {
                    MACDCross.Set(0);
                    if (zerolinecrosssound)
                    {
                        if (FirstTickOfBar)
                        {
                            PlaySound(longwavfilename);
                        }
                    }
                }

                else
                {
                    MACDCross.Reset();
                }
            }
            else
            {
                if (conservative)
                {
                    if (colorbackground)
                    {
                        BackColor = Color.FromArgb(opacity, backgroundcolorDn);
                    }
                    if (colorALLbackgrounds)
                    {
                        BackColorAll = Color.FromArgb(opacity, backgroundcolorDn);
                    }
                }
                if (CurrentBar != 0 && BBMACD[1] > 0)
                {
                    MACDCross.Set(0);
                    if (zerolinecrosssound)
                    {
                        if (FirstTickOfBar)
                        {
                            PlaySound(shortwavfilename);
                        }
                    }
                }
                else
                {
                    MACDCross.Reset();
                }
            }
        }
Beispiel #5
0
        /// <summary>
        /// The MACD (Moving Average Convergence/Divergence) is a trend following momentum indicator that shows the relationship between two moving averages of prices.
        /// </summary>
        /// <returns></returns>
        public MACD MACD(Data.IDataSeries input, int fast, int slow, int smooth)
        {
            if (cacheMACD != null)
                for (int idx = 0; idx < cacheMACD.Length; idx++)
                    if (cacheMACD[idx].Fast == fast && cacheMACD[idx].Slow == slow && cacheMACD[idx].Smooth == smooth && cacheMACD[idx].EqualsInput(input))
                        return cacheMACD[idx];

            lock (checkMACD)
            {
                checkMACD.Fast = fast;
                fast = checkMACD.Fast;
                checkMACD.Slow = slow;
                slow = checkMACD.Slow;
                checkMACD.Smooth = smooth;
                smooth = checkMACD.Smooth;

                if (cacheMACD != null)
                    for (int idx = 0; idx < cacheMACD.Length; idx++)
                        if (cacheMACD[idx].Fast == fast && cacheMACD[idx].Slow == slow && cacheMACD[idx].Smooth == smooth && cacheMACD[idx].EqualsInput(input))
                            return cacheMACD[idx];

                MACD indicator = new MACD();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.Fast = fast;
                indicator.Slow = slow;
                indicator.Smooth = smooth;
                Indicators.Add(indicator);
                indicator.SetUp();

                MACD[] tmp = new MACD[cacheMACD == null ? 1 : cacheMACD.Length + 1];
                if (cacheMACD != null)
                    cacheMACD.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheMACD = tmp;
                return indicator;
            }
        }
        /// <summary>
        /// Calculates the indicator value(s) at the current index.
        /// </summary>
        protected override void OnBarUpdate()
        {
            if (CurrentBars[0] < bandperiod)
            {
                return;
            }

            if (!init)
            {
                BMACD   = MACD(Input, fast, slow, smooth);
                EMAMACD = EMA(BMACD, bandperiod);
                HMAMACD = HMA(BMACD, smooth);
                SDBB    = StdDev(BMACD, bandperiod);
            }
            init = true;
            double macdValue = HMAMACD[0];            //BMACD[0];

            BBMACD.Set(macdValue);
            //BBMACDLine.Set(macdValue);
            BBMACDFrame.Set(macdValue);

            //double avg = EMA(BBMACD,bandperiod)[0];
            double avg = EMAMACD[0];

            ZeroLine.Set(0);

            //double stdDevValue = StdDev(BBMACD,bandperiod)[0];
            double stdDevValue = SDBB[0];

            Upper.Set(avg + StdDevNumber * stdDevValue);
            Lower.Set(avg - StdDevNumber * stdDevValue);

            //1. Green dots, above bands, sloping up Green dot - text UP - prefer up as easy to understand
            //2. Green dots, above bands, changing to a red dot. - Cell Colour will Change (but may still say UP)
            //3. Consecutive red dots crossing down through the bands - not sure we discussed this one!!! Cell colour will change Put --- to indicate crossing down
            //4. Red dots, below bands, sloping down.Red dot - text DOWN - prefer DOWN as easy to understand
            //5. Red dots, below bands, changing to a green dot.ell Colour will Change (but may still say DOWN)
            //6. Consecutive green dots, crossing up through the bands - not sure we discussed this one!!! Cell colour will change Put +++ to indicate crossing down

            //1 & 4 - would be trending signals - don't trade against these
            //2 & 5 - would be minor alerts for consolidation or the start of direction change
            //3 & 6 - would be major alerts with direction change confirmed by dots about to break through the opposite band



            if (Rising(BBMACD))
            {
                if (BBMACD[0] < Upper[0])
                {
                    PlotColors[0][0] = DotsUpInside;
                    macdsignal       = 1;
                }
                else if ((BBMACD[1] < Upper[1]) && (BBMACD[0] > Upper[0]))
                {
                    PlotColors[0][0] = DotsUpOutside;
                    macdsignal       = 2;
                }
                else
                {
                    PlotColors[0][0] = DotsUpOutside;
                    macdsignal       = 3;
                }
            }
            else
            {
                if (BBMACD[0] > Lower[0])
                {
                    PlotColors[0][0] = DotsDownInside;
                    macdsignal       = -1;
                }
                else if ((BBMACD[1] > Lower[1]) && (BBMACD[0] < Lower[0]))
                {
                    PlotColors[0][0] = DotsDownOutside;
                    macdsignal       = -2;
                }

                else
                {
                    PlotColors[0][0] = DotsDownOutside;
                    macdsignal       = -3;
                }
            }


            Signal.Set(macdsignal);



/*
 *
 *                              if (BBMACD[0] > BBMACD[1])
 *          {
 *              PlotColors[0][0] = DotsUpOutside;
 *              if ((BBMACD[0] > Upper[0]))  //UP
 *              {
 *                  macdsignal = 1;
 *                  PlotColors[0][0] = DotsUpOutside;
 *              }
 *              else if ((BBMACD[1] < Lower[1]) && (BBMACD[0] > Lower[0]))  //UP
 *              {
 *                  macdsignal = 6;
 *                  PlotColors[0][0] = DotsDownInside;
 *              }
 *              else if ((BBMACD[1] > BBMACD[2]) && (BBMACD[0] > Lower[0]))   //UP
 *              {
 *                  macdsignal = 7;
 *                  PlotColors[0][0] = DotsUpInside;
 *              }
 *              else if ((BBMACD[1] < Upper[1]) && (BBMACD[0] > Upper[0]))    //UP
 *              {
 *                  macdsignal = 8;
 *                  PlotColors[0][0] = DotsUpOutside;
 *              }
 *          }
 *          else //(BBMACD[0] < BBMACD[1])
 *          {
 *              PlotColors[0][0] = DotsDownOutside;
 *              if ((BBMACD[0] < Lower[0]))  //DN
 *              {
 *                  macdsignal = 5;
 *                  PlotColors[0][0] = DotsDownOutside;
 *              }
 *              else if ((BBMACD[0] < BBMACD[1]))  //DN
 *              {
 *                  macdsignal = 2;
 *                  PlotColors[0][0] = DotsDownOutside;
 *              }
 *              else if ((BBMACD[1] < BBMACD[2]) && (BBMACD[0] < Upper[0]))   //DN
 *              {
 *                  macdsignal = 3;
 *                  PlotColors[0][0] = DotsDownInside;
 *              }
 *              else if ((BBMACD[1] > Lower[1]) && (BBMACD[0] < Lower[0]))    //DN
 *              {
 *                  macdsignal = 4;
 *                  PlotColors[0][0] = DotsDownOutside;
 *              }
 *          }
 */
/*
 *          if ((BBMACD[0] > BBMACD[1]) && (BBMACD[0] > Upper[0]))  //UP
 *          {
 *              macdsignal = 1;
 *              PlotColors[0][0] = DotsUpOutside;
 *          }
 *          if ((BBMACD[1] > Upper[1]) && (BBMACD[0] < BBMACD[1]))  //DN
 *          {
 *              macdsignal = 2;
 *              PlotColors[0][0] = DotsDownOutside;
 *          }
 *          if ((BBMACD[0] < BBMACD[1]) && (BBMACD[1] < BBMACD[2]) && (BBMACD[0] < Upper[0]))   //DN
 *          {
 *              macdsignal = 3;
 *              PlotColors[0][0] = DotsDownInside;
 *          }
 *          if ((BBMACD[0] < BBMACD[1]) && (BBMACD[1] > Lower[1]) && (BBMACD[0] < Lower[0]))    //DN
 *          {
 *              macdsignal = 4;
 *              PlotColors[0][0] = DotsDownOutside;
 *          }
 *
 *          if ((BBMACD[0] < BBMACD[1]) && (BBMACD[0] < Lower[0]))  //DN
 *          {
 *              macdsignal = 5;
 *              PlotColors[0][0] = DotsDownOutside;
 *          }
 *          if ((BBMACD[1] < Lower[1]) && (BBMACD[0] > BBMACD[1]))  //UP
 *          {
 *              macdsignal = 6;
 *              PlotColors[0][0] = DotsDownInside;
 *          }
 *          if ((BBMACD[0] > BBMACD[1]) && (BBMACD[1] > BBMACD[2]) && (BBMACD[0] > Lower[0]))   //UP
 *          {
 *              macdsignal = 7;
 *              PlotColors[0][0] = DotsUpInside;
 *          }
 *          if ((BBMACD[0] > BBMACD[1]) && (BBMACD[1] < Upper[1]) && (BBMACD[0] > Upper[0]))    //UP
 *          {
 *              macdsignal = 8;
 *              PlotColors[0][0] = DotsUpOutside;
 *          }
 */


            /////PlotColors[2][0] = BBUpper;
            /////PlotColors[3][0] = BBLower;
            /////PlotColors[4][0] = SignalCol;
            /////PlotColors[5][0] = ZeroCol;
        }
        //###################################################################
        #endregion

        #region Create forms
#if NT7
        //#####################################################################
        /// <summary>
        /// This method is used to initialize any variables or resources. 
        /// This method is called only once immediately prior to the start of the script, 
        /// but after the Initialize() method.
        /// </summary>
        protected override void OnStartUp()
        {
            base.OnStartUp();
            
            #region GomCD
            // Uncomment the next lines to use Gomi's Cumulative Delta stuff ====================
            gomCdAll = GomCD(gomCdCalcMode, GomCDChartType.CumulativeChart,
                    "Binary", Gom.FileModeType.OnePerDay, gomCdVolumeFilterSizeMode,
                    gomCdVolumeFilterSize, false);
            // Uncomment till here ================================================================
            #endregion

            #region Divergence
            if (divergenceMode != DivergenceMode.False)
            {
                switch (divergenceMode)
                {
                    case DivergenceMode.Custom:
                        // Add custom divergence indicator here
                        break;
                    case DivergenceMode.MACD:
                        macd = MACD(param1, param2, param3);
                        break;
                    case DivergenceMode.Stochastics:
                        stochastics = Stochastics(param1, param2, param3);
                        break;
                }
            }
            #endregion

            decimal increment = Convert.ToDecimal(Instrument.MasterInstrument.TickSize);
            int incrementLength = increment.ToString().Length;
            decimalPlaces = 0;
            if (incrementLength == 1)
                decimalPlaces = 0;
            else if (incrementLength > 2)
                decimalPlaces = incrementLength - 2;

            if (ChartControl == null)
            {
                statisticPosition = StatisticPositions.False;
                showRiskManagement = false;
            }

            if (statisticPosition != StatisticPositions.False || showRiskManagement)
                toolStrip = (ToolStrip)ChartControl.Controls["tsrTool"];

                #region Statistic panel
                // Statistic panel ====================================================================
                if (statisticPosition != StatisticPositions.False)
                {
                    DockStyle dockStyle = DockStyle.Bottom;
                    switch (statisticPosition)
                    {
                        case StatisticPositions.Bottom:
                            dockStyle = DockStyle.Bottom;
                            break;
                        case StatisticPositions.Left:
                            dockStyle = DockStyle.Left;
                            break;
                        case StatisticPositions.Right:
                            dockStyle = DockStyle.Right;
                            break;
                        case StatisticPositions.Top:
                            dockStyle = DockStyle.Top;
                            break;
                        default:
                            dockStyle = DockStyle.Bottom;
                            break;
                    }

                    #region Create new control objects
                    // Create new control objects =====================================================
                    System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
                    this.panel = new System.Windows.Forms.Panel();
                    this.label = new System.Windows.Forms.Label();
                    this.mainTabControl = new System.Windows.Forms.TabControl();
                    this.tabABC = new System.Windows.Forms.TabPage();
                    this.tabSwingLength = new System.Windows.Forms.TabPage();
                    this.tabSwingRelation = new System.Windows.Forms.TabPage();
                    this.lengthList = new System.Windows.Forms.DataGridView();
                    this.colLengthDirection = new System.Windows.Forms.DataGridViewTextBoxColumn();
                    this.colLengthSwingCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
                    this.colLengthLength = new System.Windows.Forms.DataGridViewTextBoxColumn();
                    this.colLengthLastLength = new System.Windows.Forms.DataGridViewTextBoxColumn();
                    this.colLengthDuration = new System.Windows.Forms.DataGridViewTextBoxColumn();
                    this.colLengthLastDuration = new System.Windows.Forms.DataGridViewTextBoxColumn();
                    this.relationList = new System.Windows.Forms.DataGridView();
                    this.colRelationSwing = new System.Windows.Forms.DataGridViewTextBoxColumn();
                    this.colRelationSwingCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
                    this.colRelationHigherHigh = new System.Windows.Forms.DataGridViewTextBoxColumn();
                    this.colRelationLowerHigh = new System.Windows.Forms.DataGridViewTextBoxColumn();
                    this.colRelationHigherLow = new System.Windows.Forms.DataGridViewTextBoxColumn();
                    this.colRelationLowerLow = new System.Windows.Forms.DataGridViewTextBoxColumn();
                    //=================================================================================
                    #endregion

                    #region Tab Swing Length
                    //===== Tab Swing Length ==========================================================
                    // 
                    // colLengthDirection
                    // 
                    this.colLengthDirection.HeaderText = "Direction";
                    this.colLengthDirection.Name = "colLengthDirection";
                    this.colLengthDirection.ReadOnly = true;
                    this.colLengthDirection.Width = 120;
                    // 
                    // colLengthSwingCount
                    // 
                    this.colLengthSwingCount.HeaderText = "Swing Count";
                    this.colLengthSwingCount.Name = "colLengthSwingCount";
                    this.colLengthSwingCount.ReadOnly = true;
                    this.colLengthSwingCount.Width = 120;
                    // 
                    // colLengthLength
                    // 
                    this.colLengthLength.HeaderText = "Length";
                    this.colLengthLength.Name = "colLengthLength";
                    this.colLengthLength.ReadOnly = true;
                    this.colLengthLength.Width = 120;
                    // 
                    // colLengthLastLength
                    // 
                    this.colLengthLastLength.HeaderText = "Last Length";
                    this.colLengthLastLength.Name = "colLengthLastLength";
                    this.colLengthLastLength.ReadOnly = true;
                    this.colLengthLastLength.Width = 120;
                    // 
                    // colLengthDuration
                    // 
                    this.colLengthDuration.HeaderText = "Duration";
                    this.colLengthDuration.Name = "colLengthDuration";
                    this.colLengthDuration.ReadOnly = true;
                    this.colLengthDuration.Width = 120;
                    // 
                    // colLengthLastDuration
                    // 
                    this.colLengthLastDuration.HeaderText = "Last Duration";
                    this.colLengthLastDuration.Name = "colLengthLastDuration";
                    this.colLengthLastDuration.ReadOnly = true;
                    this.colLengthLastDuration.Width = 120;
                    // 
                    // lengthList
                    // 
                    this.lengthList.AllowUserToAddRows = false;
                    this.lengthList.AllowUserToDeleteRows = false;
                    this.lengthList.AllowUserToResizeColumns = false;
                    this.lengthList.AllowUserToResizeRows = false;
                    this.lengthList.BackgroundColor = System.Drawing.SystemColors.Control;
                    this.lengthList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
                    this.lengthList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
				this.colLengthDirection,
				this.colLengthSwingCount,
				this.colLengthLength,
				this.colLengthLastLength,
				this.colLengthDuration,
				this.colLengthLastDuration});
                    dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
                    dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window;
                    dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.ControlText;
                    dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
                    dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
                    dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
                    this.lengthList.DefaultCellStyle = dataGridViewCellStyle1;
                    this.lengthList.Dock = System.Windows.Forms.DockStyle.Fill;
                    this.lengthList.Location = new System.Drawing.Point(3, 3);
                    this.lengthList.Name = "lengthList";
                    this.lengthList.ReadOnly = true;
                    this.lengthList.Rows.Add("Up");
                    this.lengthList.Rows.Add("Down");
                    this.lengthList.RowHeadersVisible = false;
                    this.lengthList.RowTemplate.Height = 24;
                    this.lengthList.Size = new System.Drawing.Size(920, 305);
                    this.lengthList.TabIndex = 0;
                    // 
                    // tabSwingLength
                    // 
                    this.tabSwingLength.Controls.Add(this.lengthList);
                    this.tabSwingLength.Location = new System.Drawing.Point(4, 25);
                    this.tabSwingLength.Name = "tabSwingLength";
                    this.tabSwingLength.Padding = new System.Windows.Forms.Padding(3);
                    this.tabSwingLength.TabIndex = 1;
                    this.tabSwingLength.Text = "Swing Length";
                    this.tabSwingLength.UseVisualStyleBackColor = true;
                    //=================================================================================
                    #endregion

                    #region Tab Swing Relation
                    //===== Tab Swing Relation ========================================================
                    // 
                    // colRelationSwing
                    // 
                    this.colRelationSwing.HeaderText = "Swing";
                    this.colRelationSwing.Name = "colRelationSwing";
                    this.colRelationSwing.ReadOnly = true;
                    this.colRelationSwing.Width = 120;
                    // 
                    // colRelationSwingCount
                    // 
                    this.colRelationSwingCount.HeaderText = "Swing Count";
                    this.colRelationSwingCount.Name = "colRelationSwingCount";
                    this.colRelationSwingCount.ReadOnly = true;
                    this.colRelationSwingCount.Width = 120;
                    // 
                    // colRelationHigherHigh
                    // 
                    this.colRelationHigherHigh.HeaderText = "Higher High";
                    this.colRelationHigherHigh.Name = "colRelationHigherHigh";
                    this.colRelationHigherHigh.ReadOnly = true;
                    this.colRelationHigherHigh.Width = 120;
                    // 
                    // colRelationLowerHigh
                    // 
                    this.colRelationLowerHigh.HeaderText = "Lower High";
                    this.colRelationLowerHigh.Name = "colRelationLowerHigh";
                    this.colRelationLowerHigh.ReadOnly = true;
                    this.colRelationLowerHigh.Width = 120;
                    // 
                    // colRelationHigherLow
                    // 
                    this.colRelationHigherLow.HeaderText = "Higher Low";
                    this.colRelationHigherLow.Name = "colRelationHigherLow";
                    this.colRelationHigherLow.ReadOnly = true;
                    this.colRelationHigherLow.Width = 120;
                    // 
                    // colRelationLowerLow
                    // 
                    this.colRelationLowerLow.HeaderText = "Lower Low";
                    this.colRelationLowerLow.Name = "colRelationLowerLow";
                    this.colRelationLowerLow.ReadOnly = true;
                    this.colRelationLowerLow.Width = 120;
                    // 
                    // relationList
                    // 
                    this.relationList.AllowUserToAddRows = false;
                    this.relationList.AllowUserToDeleteRows = false;
                    this.relationList.AllowUserToResizeColumns = false;
                    this.relationList.AllowUserToResizeRows = false;
                    this.relationList.BackgroundColor = System.Drawing.SystemColors.Control;
                    this.relationList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
                    this.relationList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
				this.colRelationSwing,
				this.colRelationSwingCount,
				this.colRelationHigherHigh,
				this.colRelationLowerHigh,
				this.colRelationHigherLow,
				this.colRelationLowerLow});
                    this.relationList.DefaultCellStyle = dataGridViewCellStyle1;
                    this.relationList.Dock = System.Windows.Forms.DockStyle.Fill;
                    this.relationList.Location = new System.Drawing.Point(3, 3);
                    this.relationList.Name = "relationList";
                    this.relationList.ReadOnly = true;
                    this.relationList.Rows.Add("Higher High");
                    this.relationList.Rows.Add("Lower High");
                    this.relationList.Rows.Add("Double Top");
                    this.relationList.Rows.Add("Lower Low");
                    this.relationList.Rows.Add("Higher Low");
                    this.relationList.Rows.Add("Double Bottom");
                    this.relationList.RowHeadersVisible = false;
                    this.relationList.RowTemplate.Height = 24;
                    this.relationList.Size = new System.Drawing.Size(986, 240);
                    this.relationList.TabIndex = 1;
                    // 
                    // tabSwingRelation
                    // 
                    this.tabSwingRelation.Controls.Add(this.relationList);
                    this.tabSwingRelation.Location = new System.Drawing.Point(4, 25);
                    this.tabSwingRelation.Name = "tabSwingRelation";
                    this.tabSwingRelation.Padding = new System.Windows.Forms.Padding(3);
                    this.tabSwingRelation.TabIndex = 2;
                    this.tabSwingRelation.Text = "Swing Relation";
                    this.tabSwingRelation.UseVisualStyleBackColor = true;
                    //=================================================================================
                    #endregion

                    #region Add button to the tool strip and create main controls
                    //===== Add button to the tool strip ==============================================
                    // 
                    // toolStripSeparator
                    // 
                    toolStripSeparator = new System.Windows.Forms.ToolStripSeparator();
                    toolStripSeparator.Name = "separator";
                    // 
                    // Add controls to the toolstrip
                    // 
                    toolStrip.Items.Add(toolStripSeparator);

                    toolStripButton = new System.Windows.Forms.ToolStripButton("Hide Extras");
                    toolStripButton.Name = "button";
                    toolStripButton.Text = "Show Statistic";
                    toolStripButton.Click += buttonClick;
                    toolStripButton.Enabled = true;
                    toolStripButton.ForeColor = Color.Black;
                    toolStrip.Items.Add(toolStripButton);

                    this.splitter = new System.Windows.Forms.Splitter();
                    this.splitter.Name = "splitter";
                    this.splitter.BackColor = Color.LightGray;
                    this.splitter.Dock = dockStyle;
                    this.splitter.Hide();
                    this.splitter.Width = 3;
                    ChartControl.Controls.Add(this.splitter);
                    //===== Create panel and main tab =================================================
                    this.panel = new System.Windows.Forms.Panel();
                    this.mainTabControl = new System.Windows.Forms.TabControl();
                    // 
                    // mainTabControl
                    // 
                    this.mainTabControl.Controls.Add(this.tabSwingLength);
                    this.mainTabControl.Controls.Add(this.tabSwingRelation);
                    this.mainTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
                    this.mainTabControl.Location = new System.Drawing.Point(0, 0);
                    this.mainTabControl.Multiline = true;
                    this.mainTabControl.Name = "mainTabControl";
                    this.mainTabControl.Padding = new System.Drawing.Point(3, 3);
                    this.mainTabControl.SelectedIndex = 3;
                    this.mainTabControl.TabIndex = 0;
                    // 
                    // panel
                    // 
                    this.panel.BackColor = System.Drawing.Color.White;
                    this.panel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
                    //this.panel.Controls.Add(this.label);
                    this.panel.Controls.Add(this.mainTabControl);
                    this.panel.Dock = dockStyle;
                    this.panel.Location = new System.Drawing.Point(0, 0);
                    this.panel.MinimumSize = new System.Drawing.Size(150, 0);
                    this.panel.Name = "panel";
                    this.panel.Hide();
                    if (dockStyle == DockStyle.Bottom || dockStyle == DockStyle.Top)
                        this.panel.Size = new System.Drawing.Size(ChartControl.Width, 210);
                    else
                        this.panel.Size = new System.Drawing.Size(250, ChartControl.Height);
                    this.panel.TabIndex = 0;
                    ChartControl.Controls.Add(this.panel);
                    //=================================================================================
                    #endregion
                }
                // End statistic panel ================================================================
                #endregion

                #region Riskmanagement items
                // Riskmanagement items ===============================================================
                if (showRiskManagement)
                {
                    #region Create new control objects
                    // Create new control objects =====================================================
                    toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
                    toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
                    toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
                    toolStripLabelQty = new System.Windows.Forms.ToolStripLabel("toolStripLabelQty");
                    toolStripLabelRiskReward = new System.Windows.Forms.ToolStripLabel("toolStripLabelRiskReward");
                    toolStripLabelLoss = new System.Windows.Forms.ToolStripLabel("toolStripLabelLoss");
                    toolStripLabelProfit = new System.Windows.Forms.ToolStripLabel("toolStripLabelProfit");
                    toolStripLabelEntry = new System.Windows.Forms.ToolStripLabel("toolStripLabelEntry");
                    toolStripLabelStop = new System.Windows.Forms.ToolStripLabel("toolStripLabelStop");
                    toolStripLabelTarget = new System.Windows.Forms.ToolStripLabel("toolStripLabelTarget");
                    numericUpDownEntry = new System.Windows.Forms.NumericUpDown();
                    numericUpDownStop = new System.Windows.Forms.NumericUpDown();
                    numericUpDownTarget = new System.Windows.Forms.NumericUpDown();
                    //=================================================================================
                    #endregion

                    #region Add button to the tool strip and create main controls
                    // Properties of ToolStrip items ==================================================
                    // 
                    // toolStripSeparator
                    // 
                    toolStripSeparator1.Name = "toolStripSeparator1";
                    toolStripSeparator2.Name = "toolStripSeparator2";
                    toolStripSeparator3.Name = "toolStripSeparator3";
                    // 
                    // toolStripLabelQty
                    // 
                    toolStripLabelQty.AutoSize = false;
                    toolStripLabelQty.ForeColor = System.Drawing.Color.Black;
                    toolStripLabelQty.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    toolStripLabelQty.Name = "toolStripLabelQty";
                    toolStripLabelQty.Size = new System.Drawing.Size(126, 22);
                    toolStripLabelQty.Text = "Qty: ";
                    toolStripLabelQty.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                    // 
                    // toolStripLabelRiskReward
                    // 
                    toolStripLabelRiskReward.AutoSize = false;
                    toolStripLabelRiskReward.ForeColor = System.Drawing.Color.Black;
                    toolStripLabelRiskReward.Name = "toolStripLabelRiskReward";
                    toolStripLabelRiskReward.Size = new System.Drawing.Size(78, 22);
                    toolStripLabelRiskReward.Text = "R/R: ";
                    toolStripLabelRiskReward.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                    // 
                    // toolStripLabelLoss
                    // 
                    toolStripLabelLoss.AutoSize = false;
                    toolStripLabelLoss.ForeColor = System.Drawing.Color.Black;
                    toolStripLabelLoss.Name = "toolStripLabelLoss";
                    toolStripLabelLoss.Size = new System.Drawing.Size(96, 22);
                    toolStripLabelLoss.Text = "Loss: ";
                    toolStripLabelLoss.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                    // 
                    // toolStripLabelProfit
                    // 
                    toolStripLabelProfit.AutoSize = false;
                    toolStripLabelProfit.ForeColor = System.Drawing.Color.Black;
                    toolStripLabelProfit.Name = "toolStripLabelProfit";
                    toolStripLabelProfit.Size = new System.Drawing.Size(96, 22);
                    toolStripLabelProfit.Text = "Win: ";
                    toolStripLabelProfit.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                    // 
                    // toolStripLabelEntry
                    // 
                    toolStripLabelEntry.AutoSize = true;
                    toolStripLabelEntry.ForeColor = System.Drawing.Color.Black;
                    toolStripLabelEntry.Name = "toolStripLabelEntry";
                    toolStripLabelEntry.Text = "Entry: ";
                    // 
                    // toolStripLabelStop
                    // 
                    toolStripLabelStop.AutoSize = true;
                    toolStripLabelStop.ForeColor = System.Drawing.Color.Red;
                    toolStripLabelStop.Name = "toolStripLabelStop";
                    toolStripLabelStop.Text = " SL: ";
                    // 
                    // toolStripLabelTarget
                    // 
                    toolStripLabelTarget.AutoSize = true;
                    toolStripLabelTarget.ForeColor = System.Drawing.Color.Green;
                    toolStripLabelTarget.Name = "toolStripLabelTarget";
                    toolStripLabelTarget.Text = " PT: ";
                    // 
                    // numericUpDownEntry
                    // 
                    numericUpDownEntry.DecimalPlaces = decimalPlaces;
                    numericUpDownEntry.Increment = increment;
                    numericUpDownEntry.Maximum = new decimal(new int[] {
            999999,
            0,
            0,
            0});
                    numericUpDownEntry.Name = "numericUpDownEntry";
                    numericUpDownEntry.Size = new System.Drawing.Size(90, 22);
                    numericUpDownEntry.TabIndex = 0;
                    numericUpDownEntry.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
                    numericUpDownEntry.ThousandsSeparator = true;
                    numericUpDownEntry.UpDownAlign = System.Windows.Forms.LeftRightAlignment.Left;
                    numericUpDownEntry.Value = new decimal(new int[] {
            1000,
            0,
            0,
            0});
                    numericUpDownEntry.ValueChanged += new System.EventHandler(numericUpDown_ValueChanged);
                    // 
                    // numericUpDownStop
                    // 
                    numericUpDownStop.DecimalPlaces = decimalPlaces;
                    numericUpDownStop.Increment = increment;
                    numericUpDownStop.Maximum = new decimal(new int[] {
            999999,
            0,
            0,
            0});
                    numericUpDownStop.Name = "numericUpDownStop";
                    numericUpDownStop.Size = new System.Drawing.Size(90, 22);
                    numericUpDownStop.TabIndex = 10;
                    numericUpDownStop.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
                    numericUpDownStop.ThousandsSeparator = true;
                    numericUpDownStop.UpDownAlign = System.Windows.Forms.LeftRightAlignment.Left;
                    numericUpDownStop.Value = new decimal(new int[] {
            995,
            0,
            0,
            0});
                    numericUpDownStop.ValueChanged += new System.EventHandler(numericUpDown_ValueChanged);
                    // 
                    // numericUpDownTarget
                    // 
                    numericUpDownTarget.DecimalPlaces = decimalPlaces;
                    numericUpDownTarget.Increment = increment;
                    numericUpDownTarget.Maximum = new decimal(new int[] {
            999999,
            0,
            0,
            0});
                    numericUpDownTarget.Name = "numericUpDownTarget";
                    numericUpDownTarget.Size = new System.Drawing.Size(90, 22);
                    numericUpDownTarget.TabIndex = 9;
                    numericUpDownTarget.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
                    numericUpDownTarget.ThousandsSeparator = true;
                    numericUpDownTarget.UpDownAlign = System.Windows.Forms.LeftRightAlignment.Left;
                    numericUpDownTarget.Value = new decimal(new int[] {
            1010,
            0,
            0,
            0});
                    numericUpDownTarget.ValueChanged += new System.EventHandler(numericUpDown_ValueChanged);
                    // 
                    // Add controls to the toolstrip
                    // 
                    toolStripControlHostEntry = new ToolStripControlHost(numericUpDownEntry, "toolStripControlHostEntry");
                    toolStripControlHostEntry.AutoSize = false;
                    toolStripControlHostStop = new ToolStripControlHost(numericUpDownStop, "toolStripControlHostStop");
                    toolStripControlHostStop.AutoSize = false;
                    toolStripControlHostTarget = new ToolStripControlHost(numericUpDownTarget, "toolStripControlHostTarget");
                    toolStripControlHostTarget.AutoSize = false;
                    toolStrip.Items.Add(toolStripSeparator1);
                    toolStrip.Items.Add(toolStripLabelQty);
                    toolStrip.Items.Add(toolStripSeparator2);
                    toolStrip.Items.Add(toolStripLabelRiskReward);
                    toolStrip.Items.Add(toolStripLabelLoss);
                    toolStrip.Items.Add(toolStripLabelProfit);
                    toolStrip.Items.Add(toolStripSeparator3);
                    toolStrip.Items.Add(toolStripLabelEntry);
                    toolStrip.Items.Add(toolStripControlHostEntry);
                    toolStrip.Items.Add(toolStripLabelStop);
                    toolStrip.Items.Add(toolStripControlHostStop);
                    toolStrip.Items.Add(toolStripLabelTarget);
                    toolStrip.Items.Add(toolStripControlHostTarget);
                    //=================================================================================
                    #endregion
                }
                // End riskmanagement items ===========================================================
                #endregion
        }