Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Modifications to chart WPF elements and tab considerations

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #61
    Hello emuns,

    Please see lines 138 through 142, and lines 145 through 158 in the ChartToolBarCustomMenuExample.
    Hello All, Moving forward this will be maintained in the help guide reference samples and no longer maintained on the forum. Creating Chart WPF (UI) Modifications from an Indicator - https://ninjatrader.com/support/help...ui)-modifi.htm (https://ninjatrader.com/support/helpGuides/nt8/creating-chart-wpf-(ui)-modifi.htm) I've
    Chelsea B.NinjaTrader Customer Service

    Comment


      #62
      Hello Chelsea,

      so I recreated your ChartToolBarCustomMenuExample. My goal was to create an indicator which will hide / show selected indicators when clicking "your" SubItem1 or SubItem2 (attached indicator can hide / show SMA and EMA). Now it works as expected with one limitation.

      I open a new chart, I add indicators to it (SMA, EMA and ChartToolBarHideShowIndi) and everything works fine. When I add new tab and add the same indicators to it, than also everything works as expected. But when I get back to the first tab, than the Menu button disappears. I need to reload the chart to appear the Menu again. And the same when I go to tab 2 and so on.
      Could you be so kind please to advise me how to change the script to work it on more tabs without reloading a chart?

      Thank you,
      emuns
      Attached Files
      Last edited by emuns; 10-08-2019, 08:40 AM.

      Comment


        #63
        Hello emuns,

        I think i'm understanding you are wanting to apply the indicator to multiple tabs.

        The check for the automationid is blocking this. That was to prevent multiple menus from appearing.

        foreach (System.Windows.DependencyObject item in chartWindow.MainMenu)
        if (System.Windows.Automation.AutomationProperties.Ge tAutomationId(item) == "ChartToolbarExampleMenu")
        return;

        That part would need to be removed.

        Chelsea B.NinjaTrader Customer Service

        Comment


          #64
          Chelsea, you are nr. 1

          Thank you for your help, and great examples!

          Comment


            #65
            Hello Chelsea and NinjaTrader gurus!

            Thanks for those really useful samples, the prompt responses and the general awesomeness!

            Currently the various samples appear limited to buttons and menus / combo-boxes. Is it possible to insert other controls such as edit fields, check-boxes or radio-buttons?

            In particular in the 'NinjaTrader.Gui.Tools' namespace I see NumericTextBox and NTTextBlock...

            Q1: Would the above work to provide a numeric input field and a string input field respectively?
            Q2: Are radio-buttons and check-boxes provided as primitives?
            Q3: Do the above work in all the contexts you can insert controls (on toolbar, on chart, in the 'Chart Trader' panel)
            Q4: Any samples floating around where someone has been able to craft a collection of controls featuring the above controls?

            Thanks again for the expert assistance!

            Comment


              #66
              Hello JPPoulin,

              Yes, for the most part any WPF control can be used and it doesn't have to NinjaTrader tools. I generally use these where possible to try and match the rest of the theme.

              NumericTextBox and NTTextBlock I haven't used but they may suit your purposes. I recommend you give them a try.

              Radio buttons and checkboxes in WPF are Controls in System.Windows.Controls. Primitives are generally aspects of a control such as the popup of MenuItem.
              Below is a public link to Microsoft's documentation on primitives.
              Contains base classes and controls that are intended to be used as part of other more complex controls.


              WPF can generally be inserted anywhere that doesn't cause a WPF error.

              The AddonFrameWork basic has a lot of WPF work in it.

              Chelsea B.NinjaTrader Customer Service

              Comment


                #67
                Awesome, thanks again for the prompt and useful response Chelsea.

                I decided to automate Access instead so all instances of my strategy can pull from one form's controls and each instance pull its unique params from an Access table. I also push performance reports and very verbose logging into the many tables I'm designing. Works great!

                Comment


                  #68
                  Hi Chelsea, can you please help me fix an error I encountered. I downloaded (today) and installed your "ChartTraderCustomButtonsExample". Works great! But I wanted to have this button call an existing method in my indicator code when clicked.

                  I can Draw.Text from the method but get an error with Draw.Ray: "Unhandled exception: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name:index". To keep things simple, I get the same error when I add just one line of code to your indicator ChartTraderCustomButtonsExample. Here is the code snippet starting at line 60.

                  protected void Button2Click(object sender, RoutedEventArgs e)
                  {
                  Draw.TextFixed(this, "infobox", "Button 2 Clicked", TextPosition.BottomLeft, Brushes.DarkRed, new Gui.Tools.SimpleFont("Arial", 25), Brushes.Transparent,
                  Brushes.Transparent, 100);
                  Draw.Ray(this, "myRay",false, 5,3200,10,3200,Brushes.Lime, NinjaTrader.Gui.DashStyleHelper.Solid,1); //this is the line I added
                  ForceRefresh();
                  }

                  Any assistance is greatly appreciated.

                  Comment


                    #69
                    Hello REI140205,

                    Anything involving series requires TriggerCustomEvent().

                    Below is a link to the help guide.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #70
                      Hi ChelseaB,
                      In your code for "ChartCustomSidePanelExample" you use the first buttonGrid for writing text. You made the height = 100 for the text.
                      Is there a way to update that text block realtime with either changes that I want to report on every bar close or every price change?
                      Thanks for your epic work with menu and buttons.

                      Comment


                        #71
                        Hello dtl-saw,

                        If you are setting the text directly to the button content, I don't think that can be formatted.

                        You would need to make a new textblock or label which can be formatted and assign that to the content of the button
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #72
                          Hello ChelseaB,
                          Thanks for your response - I have the text doing what I wanted now.
                          One other thing. The panel and buttons are wider than I want, so if I could halve the width of the panel it would be much better for my use case.
                          I did make these changes to your code - changing the width in this statement from 125 to 60.
                          chartGrid.ColumnDefinitions.Insert((chartTraderStartColumn + 2), newSystem.Windows.Controls.ColumnDefinition() { Width = newGridLength(125) });

                          changing the width from 125 to 60 made the panel narrower but it looked like the buttons were not scaling down as if there was some other button width settings or some other scaling parameters.
                          Could you suggest the best approach for narrowing the right side panel.
                          Thanks again

                          Comment


                            #73
                            Hello dtl-saw,

                            The button widths are hard coded and not designed to expand as I was having some difficulties with expanding the chart trader to the right of it.

                            If I am able to work this out, I will update my post with new versions.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #74
                              Hi ChelseaB,
                              Please suggest the modifications I can make to your ChartCustomToolBarExample.cs that would only use the top menu item row and not include the left menu item. I don't need the left column menu items and it's currently shifting everything on the chart over by the column width which I want to reclaim. My efforts so far haven't been able to reclaim that left column space.
                              thanks

                              Comment


                                #75
                                Hello dtl-saw,

                                The leftInnerGrid Grid contains the left menu buttons.

                                The chartGrid.ColumnDefinitions.Insert() call adds the column to the main chart grid for that leftInnerGrid.
                                Chelsea B.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by frankthearm, Today, 09:08 AM
                                3 responses
                                9 views
                                0 likes
                                Last Post NinjaTrader_Clayton  
                                Started by yertle, Today, 08:38 AM
                                5 responses
                                15 views
                                0 likes
                                Last Post NinjaTrader_BrandonH  
                                Started by adeelshahzad, Today, 03:54 AM
                                3 responses
                                16 views
                                0 likes
                                Last Post NinjaTrader_BrandonH  
                                Started by bill2023, Yesterday, 08:51 AM
                                6 responses
                                27 views
                                0 likes
                                Last Post NinjaTrader_Erick  
                                Started by NinjaTrader_ChelseaB, 01-08-2017, 06:59 PM
                                80 responses
                                19,667 views
                                5 likes
                                Last Post NinjaTrader_ChelseaB  
                                Working...
                                X