protected override void OnStateChange()
 {
     if (State == State.SetDefaults)
     {
         Description             = @"Enter the description for your new custom Indicator here.";
         Name                    = "MyScreenTaker";
         Calculate               = Calculate.OnBarClose;
         IsOverlay               = false;
         DisplayInDataBox        = true;
         DrawOnPricePanel        = true;
         DrawHorizontalGridLines = true;
         DrawVerticalGridLines   = true;
         PaintPriceMarkers       = true;
         ScaleJustification      = NinjaTrader.Gui.Chart.ScaleJustification.Right;
         //Disable this property if your indicator requires custom values that cumulate with each new market data event.
         //See Help Guide for additional information.
         IsSuspendedWhileInactive = true;
     }
     else if (State == State.Configure)
     {
         Dispatcher.BeginInvoke(new Action(() =>
         {
             chart = Window.GetWindow(ChartControl) as Chart;
         }));
     }
 }
Пример #2
0
        // -----------------------------------------------------------------------------------------------------------------------------------------------------
        protected override void OnStateChange()

        {
            /// Create the folder at user documents
            System.IO.Directory.CreateDirectory(chartScreenShots);
            //
            if (State == State.SetDefaults)
            {
                Description             = @"Send and email when volumen is above a target in X time period chart";
                Name                    = "A0_AlertVolumeAboveTarget";
                Calculate               = Calculate.OnBarClose;
                IsOverlay               = false;
                DisplayInDataBox        = false;
                DrawOnPricePanel        = false;
                DrawHorizontalGridLines = false;
                DrawVerticalGridLines   = false;
                PaintPriceMarkers       = false;
                ScaleJustification      = NinjaTrader.Gui.Chart.ScaleJustification.Right;

                //Disable this property if your indicator requires custom values that cumulate with each new market data event.
                //See Help Guide for additional information.
                IsSuspendedWhileInactive = false;
                Email         = @"*****@*****.**";
                volumenTarget = 2000;
                candleSize    = 8;
            }
            else if (State == State.Configure)
            {
                AddDataSeries("NQ 12-18", Data.BarsPeriodType.Minute, 1, Data.MarketDataType.Last);
                Dispatcher.BeginInvoke(new Action(() => {
                    chart = Window.GetWindow(ChartControl) as Chart;
                }));
            }
        }
Пример #3
0
        //private bool ScreenShotSent   = false;
//		private double cRSI = 0.0;
//		private double ub = 0.0;
//		private double db = 0.0;
//		private double rawRSI = 0.0;

        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description              = @"Cyclic Smoothed RSI Indicator";
                Name                     = "WTT cRSI HTF";
                Calculate                = Calculate.OnBarClose;
                IsOverlay                = false;
                DisplayInDataBox         = true;
                DrawOnPricePanel         = true;
                DrawHorizontalGridLines  = true;
                DrawVerticalGridLines    = true;
                PaintPriceMarkers        = false;
                ScaleJustification       = NinjaTrader.Gui.Chart.ScaleJustification.Right;
                IsSuspendedWhileInactive = true;

                munutesHtf    = 4500;
                CycleLength   = 20;
                Vibration     = 10;
                CyclicMemory  = 40;
                Leveling      = 10;
                ShowZones     = true;
                LineThickness = 5;
                Opacity       = 30;
                UpColor       = Brushes.DodgerBlue;
                DnColor       = Brushes.Red;
                SendAlert     = false;
                AddPlot(Brushes.Red, "CRSI");
                AddPlot(Brushes.Blue, "cRSIUpper");
                AddPlot(Brushes.Gray, "cRSINeutral");
                AddPlot(Brushes.Blue, "cRSILower");
            }
            else if (State == State.Configure)
            {
                cycleConstant = (CycleLength - 1);
                torque        = 2.0 / (Vibration + 1);
                phasingLag    = (int)Math.Ceiling((Vibration - 1) / 2.0);

                Dispatcher.BeginInvoke(new Action(() =>
                {
                    chart = Window.GetWindow(ChartControl) as Chart;
                }));

                AddDataSeries(Data.BarsPeriodType.Tick, munutesHtf);
            }
            else if (State == State.DataLoaded)
            {
                //init
                avgUp   = new Series <double>(this);
                avgDown = new Series <double>(this);
                down    = new Series <double>(this);
                up      = new Series <double>(this);
                raw     = new Series <double>(this);
            }
        }
Пример #4
0
        protected void CreateWPFControls()
        {
            chartWindow      = System.Windows.Window.GetWindow(ChartControl.Parent) as NinjaTrader.Gui.Chart.Chart;
            chartTraderGrid  = (Window.GetWindow(ChartControl.Parent).FindFirst("ChartWindowChartTraderControl") as ChartTrader).Content as System.Windows.Controls.Grid;
            buyMarketButton  = chartTraderGrid.FindFirst("ChartTraderControlQuickBuyMarketButton") as System.Windows.Controls.Button;
            sellMarketButton = chartTraderGrid.FindFirst("ChartTraderControlQuickSellMarketButton") as System.Windows.Controls.Button;

            originalButtonColor = buyMarketButton.Background;

            if (TabSelected())
            {
                ShowWPFControls();
            }

            chartWindow.MainTabControl.SelectionChanged += TabChangedHandler;
        }
Пример #5
0
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description             = @"Enter the description for your new custom Indicator here.";
                Name                    = "EMJTrend";
                Calculate               = Calculate.OnBarClose;
                IsOverlay               = true;
                DisplayInDataBox        = true;
                DrawOnPricePanel        = true;
                DrawHorizontalGridLines = true;
                DrawVerticalGridLines   = true;
                PaintPriceMarkers       = true;
                ScaleJustification      = NinjaTrader.Gui.Chart.ScaleJustification.Right;
                //Disable this property if your indicator requires custom values that cumulate with each new market data event.
                //See Help Guide for additional information.
                IsSuspendedWhileInactive = true;
                Slow               = 116;
                Medium             = 68;
                Fast               = 34;
                PlotAverages       = false;
                PlotChop           = true;
                MajorWaveUpColor   = Brushes.Goldenrod;
                ChopOpacity        = 30;
                PlotKeltnerEntries = false;
                ColorBars          = true;
                UpColor            = Brushes.DodgerBlue;
                DnColor            = Brushes.Red;

                AddPlot(new Stroke(Brushes.DarkGoldenrod, 8), PlotStyle.Line, "SlowPlot");
                AddPlot(new Stroke(Brushes.MediumBlue, 4), PlotStyle.Line, "MedPlot");
                AddPlot(new Stroke(Brushes.Red, 1), PlotStyle.Line, "FastPlot");

                fastSeries = new Series <double>(this, MaximumBarsLookBack.Infinite);
                slowSeries = new Series <double>(this, MaximumBarsLookBack.Infinite);
            }
            else if (State == State.Configure)
            {
                Plots[2].DashStyleHelper = dashStyle;

                Dispatcher.BeginInvoke(new Action(() =>
                {
                    chart = Window.GetWindow(ChartControl) as Chart;
                }));
            }
        }
Пример #6
0
 protected override void OnStateChange()
 {
     if (State == State.SetDefaults)
     {
         Description              = @"Takes a screenshot of the chart and sends to email in PNG format.";
         Name                     = "ChartToEmail";
         Calculate                = Calculate.OnBarClose;
         IsOverlay                = true;
         DisplayInDataBox         = true;
         DrawOnPricePanel         = true;
         DrawHorizontalGridLines  = true;
         DrawVerticalGridLines    = true;
         PaintPriceMarkers        = true;
         ScaleJustification       = NinjaTrader.Gui.Chart.ScaleJustification.Right;
         IsSuspendedWhileInactive = true;
     }
     else if (State == State.Configure)
     {
         Dispatcher.BeginInvoke(new Action(() =>
         {
             chart = Window.GetWindow(ChartControl) as Chart;
         }));
     }
 }
Пример #7
0
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description              = @"DOP Trading levels displayed on a price chart";
                Name                     = "DOP Buttons Lines";
                Calculate                = Calculate.OnBarClose;
                IsOverlay                = true;
                DisplayInDataBox         = true;
                DrawOnPricePanel         = true;
                DrawHorizontalGridLines  = true;
                DrawVerticalGridLines    = true;
                PaintPriceMarkers        = false;
                ScaleJustification       = NinjaTrader.Gui.Chart.ScaleJustification.Right;
                IsSuspendedWhileInactive = true;
                Text                     = string.Empty;
                KPColor                  = Brushes.Orange;
                CPAColor                 = Brushes.CornflowerBlue;
                KPAoff                   = false;
                AudioAlertsOn            = false;
                KPALertSound             = "Alert1.wav";
                CPAALertSound            = "Alert2.wav";
                ImportantAreaALertSound  = "Alert3.wav";
                SendSMS                  = false;
                SMSAddress               = "*****@*****.**";
                HostEmailAddress         = "*****@*****.**";
                HostAddress              = "smtp.gmail.com";
                HostPort                 = 587;
                HostUserName             = "******";
                HostPassword             = "******";
                WatchArea1               = 2856.00;
                WatchArea2               = 2875.00;
                WatchArea3               = 2900.00;

                CPALineWidth = 3;
                KPALineWidth = 1;

                SimpleColsol  = true;
                ComplexConsol = true;

                Period = 3;
            }
            else if (State == State.Configure)
            {
                ClearOutputWindow();
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    chart = Window.GetWindow(ChartControl) as Chart;
                }));

                s.TargetType = typeof(System.Windows.Controls.Button);
                s.Setters.Add(new Setter(System.Windows.Controls.Button.FontSizeProperty, 11.0));
                s.Setters.Add(new Setter(System.Windows.Controls.Button.BackgroundProperty, Brushes.DimGray));
                s.Setters.Add(new Setter(System.Windows.Controls.Button.ForegroundProperty, Brushes.WhiteSmoke));
                s.Setters.Add(new Setter(System.Windows.Controls.Button.FontFamilyProperty, new FontFamily("Arial")));
                s.Setters.Add(new Setter(System.Windows.Controls.Button.FontWeightProperty, FontWeights.Bold));
            }
            else if (State == State.Historical)
            {
                if (!IsToolBarButtonAdded)
                {
                    AddFirstButton();
                    AddSecondButton();
                    AddThirdButton();
                }
            }
            else if (State == State.Terminated)
            {
                DisposeCleanUp();
            }
            else if (State == State.DataLoaded)
            {
                min = MIN(Low, Period);
                max = MAX(High, Period);
            }
        }
Пример #8
0
        protected void CreateWPFControls()
        {
            chartWindow = System.Windows.Window.GetWindow(ChartControl.Parent) as Chart;
            chartGrid   = chartWindow.MainTabControl.Parent as System.Windows.Controls.Grid;
            chartTrader = chartWindow.FindFirst("ChartWindowChartTraderControl") as Gui.Chart.ChartTrader;

            buttonGrid = new System.Windows.Controls.Grid();

            buttonGrid.RowDefinitions.Add(new System.Windows.Controls.RowDefinition()
            {
                Height = new GridLength(50)
            });
            buttonGrid.RowDefinitions.Add(new System.Windows.Controls.RowDefinition()
            {
                Height = new GridLength(50)
            });
            buttonGrid.RowDefinitions.Add(new System.Windows.Controls.RowDefinition()
            {
                Height = new GridLength(50)
            });

            System.Windows.Controls.TextBlock label = new System.Windows.Controls.TextBlock()
            {
                FontFamily          = ChartControl.Properties.LabelFont.Family,
                FontSize            = 13,
                Foreground          = ChartControl.Properties.ChartText,
                HorizontalAlignment = HorizontalAlignment.Center,
                Margin = new Thickness(5, 5, 5, 5),
                Text   = string.Format("{0} {1} {2}", Instrument.FullName, BarsPeriod.Value, BarsPeriod.BarsPeriodType)
            };

            System.Windows.Controls.Grid.SetRow(label, 0);
            buttonGrid.Children.Add(label);

            button1 = new System.Windows.Controls.Button()
            {
                Content             = "Button 1",
                HorizontalAlignment = HorizontalAlignment.Center
            };
            button1.Click += Button1_Click;

            System.Windows.Controls.Grid.SetRow(button1, 1);
            buttonGrid.Children.Add(button1);

            button2 = new System.Windows.Controls.Button()
            {
                Content             = "Button 2",
                HorizontalAlignment = HorizontalAlignment.Center
            };
            button2.Click += Button2_Click;

            System.Windows.Controls.Grid.SetRow(button2, 2);
            buttonGrid.Children.Add(button2);

            if (TabSelected())
            {
                InsertWPFControls();
            }

            chartWindow.MainTabControl.SelectionChanged += TabChangedHandler;
        }
Пример #9
0
        protected void CreateWPFControls()
        {
            chartWindow = System.Windows.Window.GetWindow(ChartControl.Parent) as NinjaTrader.Gui.Chart.Chart;
            chartGrid   = chartWindow.MainTabControl.Parent as System.Windows.Controls.Grid;
            chartTrader = chartWindow.FindFirst("ChartWindowChartTraderControl") as Gui.Chart.ChartTrader;

            //chartGrid.Background = BackBrush;

            // upper tool bar objects
            // upper tool bar menu
            topMenu = new System.Windows.Controls.Menu()
            {
                Background        = activeBackgroundDarkGray,
                BorderBrush       = controlLightGray,
                Padding           = new System.Windows.Thickness(0),
                Margin            = new System.Windows.Thickness(0),
                VerticalAlignment = VerticalAlignment.Center
            };

            Style mmiStyle = Application.Current.TryFindResource("MainMenuItem") as Style;

            topMenuItem1 = new Gui.Tools.NTMenuItem()
            {
                Background        = controlLightGray,
                Foreground        = textColor,
                Header            = "Menu 1     v",
                Margin            = new System.Windows.Thickness(0),
                Padding           = new System.Windows.Thickness(1),
                Style             = mmiStyle,
                VerticalAlignment = VerticalAlignment.Center
            };

            topMenuItem1SubItem1 = new Gui.Tools.NTMenuItem()
            {
                Background      = controlLightGray,
                BorderThickness = new System.Windows.Thickness(0),
                Foreground      = textColor,
                Header          = "Submenu Item 1"
            };

            topMenuItem1SubItem1.Click += TopMenuItem1SubItem1_Click;
            topMenuItem1.Items.Add(topMenuItem1SubItem1);

            topMenuItem1SubItem2 = new Gui.Tools.NTMenuItem()
            {
                Background = controlLightGray,
                Foreground = textColor,
                Header     = "Submenu Item 2"
            };
            topMenuItem1SubItem2.Click += TopMenuItem1SubItem2_Click;
            topMenuItem1.Items.Add(topMenuItem1SubItem2);

            topMenu.Items.Add(topMenuItem1);

            // upper tool bar button, has text and image
            topMenuItem2 = new System.Windows.Controls.MenuItem()
            {
                Background = controlLightGray,
                FontSize   = 12,
                Foreground = textColor,
                Padding    = new System.Windows.Thickness(1),
                Margin     = new System.Windows.Thickness(5, 0, 5, 0)
            };

            // this stackpanel allows us to place text and a picture horizontally in topMenuItem2
            System.Windows.Controls.StackPanel topMenuItem2StackPanel = new System.Windows.Controls.StackPanel()
            {
                Orientation         = System.Windows.Controls.Orientation.Horizontal,
                VerticalAlignment   = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Right
            };

            System.Windows.Controls.TextBlock newTextBlock = new System.Windows.Controls.TextBlock()
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                Margin            = new System.Windows.Thickness(0, 0, 2, 0),
                Text              = "B1 ",
                ToolTip           = "Button 1",
                VerticalAlignment = VerticalAlignment.Top
            };

            topMenuItem2StackPanel.Children.Add(newTextBlock);

            // check to see if an image exists in Documents\bin\Custom\Indicators called B1.png.
            // if its there, include this with the button
            System.Windows.Media.Imaging.BitmapImage buttonImage = new System.Windows.Media.Imaging.BitmapImage();

            try
            {
                buttonImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(NinjaTrader.Core.Globals.UserDataDir + @"bin\Custom\Indicators\B1.png"));
            }
            catch (Exception e) { }

            System.Windows.Controls.Image imageControl = new System.Windows.Controls.Image();

            if (buttonImage != null)
            {
                imageControl = new System.Windows.Controls.Image()
                {
                    Source = buttonImage,
                    Height = 10,
                    Width  = 10
                };
            }

            if (buttonImage != null)
            {
                topMenuItem2StackPanel.Children.Add(imageControl);
            }

            topMenuItem2.Header = topMenuItem2StackPanel;
            topMenuItem2.Click += TopMenuItem2_Click;
            topMenu.Items.Add(topMenuItem2);

            // bottom toolbar objects
            botMenu = new System.Windows.Controls.Menu()
            {
                Background        = activeBackgroundDarkGray,
                BorderBrush       = controlLightGray,
                Padding           = new System.Windows.Thickness(0),
                Margin            = new System.Windows.Thickness(0),
                VerticalAlignment = VerticalAlignment.Center
            };

            Style mmiStyleBot = Application.Current.TryFindResource("MainMenuItem") as Style;

            botMenuItem1 = new Gui.Tools.NTMenuItem()
            {
                Background        = controlLightGray,
                Foreground        = textColor,
                Header            = "Menu 1     v",
                Margin            = new System.Windows.Thickness(0),
                Padding           = new System.Windows.Thickness(1),
                Style             = mmiStyleBot,
                VerticalAlignment = VerticalAlignment.Center
            };

            botMenuItem1SubItem1 = new Gui.Tools.NTMenuItem()
            {
                Background      = controlLightGray,
                BorderThickness = new System.Windows.Thickness(0),
                Foreground      = textColor,
                Header          = "Submenu Item 1"
            };

            botMenuItem1SubItem1.Click += BotMenuItem1SubItem1_Click;
            botMenuItem1.Items.Add(botMenuItem1SubItem1);

            botMenuItem1SubItem2 = new Gui.Tools.NTMenuItem()
            {
                Background = controlLightGray,
                Foreground = textColor,
                Header     = "Submenu Item 2"
            };
            botMenuItem1SubItem2.Click += BotMenuItem1SubItem2_Click;
            botMenuItem1.Items.Add(botMenuItem1SubItem2);

            botMenu.Items.Add(botMenuItem1);

            // upper tool bar button, has text and image
            botMenuItem2 = new System.Windows.Controls.MenuItem()
            {
                Background = controlLightGray,
                FontSize   = 12,
                Foreground = textColor,
                Padding    = new System.Windows.Thickness(1),
                Margin     = new System.Windows.Thickness(5, 0, 5, 0)
            };

            // this stackpanel allows us to place text and a picture horizontally in topMenuItem2
            System.Windows.Controls.StackPanel botMenuItem2StackPanel = new System.Windows.Controls.StackPanel()
            {
                Orientation         = System.Windows.Controls.Orientation.Horizontal,
                VerticalAlignment   = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Right
            };

            System.Windows.Controls.TextBlock newTextBlockBot = new System.Windows.Controls.TextBlock()
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                Margin            = new System.Windows.Thickness(0, 0, 2, 0),
                Text              = "B1 ",
                ToolTip           = "Button 1",
                VerticalAlignment = VerticalAlignment.Top
            };

            botMenuItem2StackPanel.Children.Add(newTextBlockBot);

            // check to see if an image exists in Documents\bin\Custom\Indicators called B1.png.
            // if its there, include this with the button
            buttonImage = new System.Windows.Media.Imaging.BitmapImage();

            try
            {
                buttonImage = new System.Windows.Media.Imaging.BitmapImage(new Uri(NinjaTrader.Core.Globals.UserDataDir + @"bin\Custom\Indicators\B1.png"));
            }
            catch (Exception e) { }

            imageControl = new System.Windows.Controls.Image();

            if (buttonImage != null)
            {
                imageControl = new System.Windows.Controls.Image()
                {
                    Source = buttonImage,
                    Height = 10,
                    Width  = 10
                };
            }

            if (buttonImage != null)
            {
                botMenuItem2StackPanel.Children.Add(imageControl);
            }

            botMenuItem2.Header = botMenuItem2StackPanel;
            botMenuItem2.Click += BotMenuItem2_Click;
            botMenu.Items.Add(botMenuItem2);

            // left toolbar objects
            // each vertical object needs its own menu
            leftInnerGrid = new System.Windows.Controls.Grid();

            leftInnerGrid.RowDefinitions.Add(new System.Windows.Controls.RowDefinition());
            leftInnerGrid.RowDefinitions[0].Height = new GridLength(1, GridUnitType.Star);

            leftInnerGrid.RowDefinitions.Add(new System.Windows.Controls.RowDefinition());
            leftInnerGrid.RowDefinitions[1].Height = new GridLength(30);

            leftMenu1 = new System.Windows.Controls.Menu()
            {
                Background = activeBackgroundDarkGray,
                Margin     = new System.Windows.Thickness(0),
                Padding    = new System.Windows.Thickness(0)
            };

            leftMenu2 = new System.Windows.Controls.Menu()
            {
                Background = activeBackgroundDarkGray,
                Margin     = new System.Windows.Thickness(0),
                Padding    = new System.Windows.Thickness(0)
            };

            // this allows us to make our menus stack vertically
            System.Windows.Controls.VirtualizingStackPanel VerticalStackPanel = new System.Windows.Controls.VirtualizingStackPanel()
            {
                Background          = activeBackgroundDarkGray,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Orientation         = System.Windows.Controls.Orientation.Vertical,
                VerticalAlignment   = VerticalAlignment.Stretch
            };

            NinjaTrader.Gui.Tools.NTMenuItem leftMenu1Item1 = new Gui.Tools.NTMenuItem()
            {
                Background          = controlLightGray,
                Foreground          = textColor,
                Header              = "M2 v",
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin              = new System.Windows.Thickness(0),
                Padding             = new System.Windows.Thickness(0),                            /*,
                                                                                                   * Style				= Application.Current.TryFindResource("MainMenuItem") as Style*/
                ToolTip             = "Menu 2",
                VerticalAlignment   = VerticalAlignment.Stretch
            };

            leftMenu1Item1SubItem1 = new Gui.Tools.NTMenuItem()
            {
                Background      = controlLightGray,
                BorderThickness = new System.Windows.Thickness(0),
                Foreground      = textColor,
                Header          = "Submenu Item 1"
            };

            leftMenu1Item1SubItem1.Click += LeftMenu1Item1SubItem1_Click;
            leftMenu1Item1.Items.Add(leftMenu1Item1SubItem1);

            NinjaTrader.Gui.Tools.NTMenuItem leftMenu1Item1SubItem2 = new Gui.Tools.NTMenuItem()
            {
                Background = controlLightGray,
                Foreground = textColor,
                Header     = "Submenu Item 2"
            };

            leftMenu1Item1SubItem2.Click += LeftMenu1Item1SubItem2_Click;
            leftMenu1Item1.Items.Add(leftMenu1Item1SubItem2);

            leftMenu1.Items.Add(leftMenu1Item1);
            VerticalStackPanel.Children.Add(leftMenu1);

            leftMenu2Item1 = new System.Windows.Controls.MenuItem()
            {
                Background          = controlLightGray,
                FontSize            = 12,
                Foreground          = textColor,
                Header              = "B2",
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin              = new System.Windows.Thickness(0),
                Padding             = new System.Windows.Thickness(0),
                VerticalAlignment   = VerticalAlignment.Stretch
            };

            leftMenu2Item1.Click += LeftMenu2Item1_Click;
            leftMenu2.Items.Add(leftMenu2Item1);

            VerticalStackPanel.Children.Add(leftMenu2);
            leftInnerGrid.Children.Add(VerticalStackPanel);

            // right panel
            rightInnerGrid = new System.Windows.Controls.Grid();

            rightInnerGrid.RowDefinitions.Add(new System.Windows.Controls.RowDefinition());
            rightInnerGrid.RowDefinitions[0].Height = new GridLength(1, GridUnitType.Star);

            rightInnerGrid.RowDefinitions.Add(new System.Windows.Controls.RowDefinition());
            rightInnerGrid.RowDefinitions[1].Height = new GridLength(30);

            rightMenu1 = new System.Windows.Controls.Menu()
            {
                Background = activeBackgroundDarkGray,
                Margin     = new System.Windows.Thickness(0),
                Padding    = new System.Windows.Thickness(0)
            };

            rightMenu2 = new System.Windows.Controls.Menu()
            {
                Background = activeBackgroundDarkGray,
                Margin     = new System.Windows.Thickness(0),
                Padding    = new System.Windows.Thickness(0)
            };

            // this allows us to make our menus stack vertically
            System.Windows.Controls.VirtualizingStackPanel VerticalStackPanelRight = new System.Windows.Controls.VirtualizingStackPanel()
            {
                Background          = activeBackgroundDarkGray,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Orientation         = System.Windows.Controls.Orientation.Vertical,
                VerticalAlignment   = VerticalAlignment.Stretch
            };

            NinjaTrader.Gui.Tools.NTMenuItem rightMenu1Item1 = new Gui.Tools.NTMenuItem()
            {
                Background          = controlLightGray,
                Foreground          = textColor,
                Header              = "M2 v",
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin              = new System.Windows.Thickness(0),
                Padding             = new System.Windows.Thickness(0),                            /*,
                                                                                                   * Style				= Application.Current.TryFindResource("MainMenuItem") as Style*/
                ToolTip             = "Menu 2",
                VerticalAlignment   = VerticalAlignment.Stretch
            };

            rightMenu1Item1SubItem1 = new Gui.Tools.NTMenuItem()
            {
                Background      = controlLightGray,
                BorderThickness = new System.Windows.Thickness(0),
                Foreground      = textColor,
                Header          = "Submenu Item 1"
            };

            rightMenu1Item1SubItem1.Click += RightMenu1Item1SubItem1_Click;
            rightMenu1Item1.Items.Add(rightMenu1Item1SubItem1);

            NinjaTrader.Gui.Tools.NTMenuItem rightMenu1Item1SubItem2 = new Gui.Tools.NTMenuItem()
            {
                Background = controlLightGray,
                Foreground = textColor,
                Header     = "Submenu Item 2"
            };

            rightMenu1Item1SubItem2.Click += RightMenu1Item1SubItem2_Click;
            rightMenu1Item1.Items.Add(rightMenu1Item1SubItem2);

            rightMenu1.Items.Add(rightMenu1Item1);
            VerticalStackPanelRight.Children.Add(rightMenu1);

            rightMenu2Item1 = new System.Windows.Controls.MenuItem()
            {
                Background          = controlLightGray,
                FontSize            = 12,
                Foreground          = textColor,
                Header              = "B2",
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin              = new System.Windows.Thickness(0),
                Padding             = new System.Windows.Thickness(0),
                VerticalAlignment   = VerticalAlignment.Stretch
            };

            rightMenu2Item1.Click += RightMenu2Item1_Click;
            rightMenu2.Items.Add(rightMenu2Item1);

            VerticalStackPanelRight.Children.Add(rightMenu2);
            rightInnerGrid.Children.Add(VerticalStackPanelRight);

            if (TabSelected())
            {
                InsertWPFControls();
            }

            chartWindow.MainTabControl.SelectionChanged += TabChangedHandler;
        }