• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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.
    https://ninjatrader.com/support/foru...ions#post96376
    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, 07: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.
              https://docs.microsoft.com/en-us/dot...tframework-4.8

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

              The AddonFrameWork basic has a lot of WPF work in it.
              http://ninjatrader.com/support/helpG...ript_Basic.zip
              https://ninjatrader.com/support/help...t_overview.htm
              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.
                    https://ninjatrader.com/support/help...ustomevent.htm
                    Chelsea B.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by ralett, Yesterday, 07:29 PM
                    1 response
                    6 views
                    0 likes
                    Last Post NinjaTrader_Marco  
                    Started by bboyle1234, Yesterday, 10:46 PM
                    1 response
                    5 views
                    0 likes
                    Last Post bltdavid  
                    Started by swcooke, Yesterday, 04:29 PM
                    0 responses
                    5 views
                    0 likes
                    Last Post swcooke
                    by swcooke
                     
                    Started by bboyle1234, Yesterday, 04:27 PM
                    0 responses
                    2 views
                    0 likes
                    Last Post bboyle1234  
                    Started by swcooke, Yesterday, 03:31 PM
                    2 responses
                    12 views
                    0 likes
                    Last Post swcooke
                    by swcooke
                     
                    Working...
                    X