Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding a custom button to chartWindow sometimes does not appear on all tab charts

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

    Adding a custom button to chartWindow sometimes does not appear on all tab charts

    Hello NT8. I have an indicator that uses a custom button on chartWindow. It works fine until I setup multiple tabs with in the same chart. Under such conditions the custom button may or may not show up within the chart control for each tab. Shouldn't the button be global for all tabs within chart ?


    Please refer to attached files for clarity.

    many thanks..........
    Attached Files

    #2
    Hello pvtrader,

    If you are adding the button to the window that should be able to appear while switching tabs but the event may or may not work in case your indicator has been suspended. Iif it disappears that may be that your termination logic is being run I really couldn't say without a specific example of the code used.

    What is your overall goal for the button and tab situation? Did you want only 1 button to appear per chart no matter how many tabs? Did you want to turn the button off and add a button for a different indicator on the other tab? Does the button apply to all tabs or is it for a singular instrument?

    When programming UI items in a chart if you need to do anything based on switching tabs you will need to add handling for that. There is a good sample that demonstrates all of what is needed to handle tabs in the following link, the ChartCustomToolBarExample: https://ninjatrader.com/support/foru...t=1#post499327

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse,

      Thanks for the prompt. reply. I think I contradicted myself. Each tab within the chart invokes its own instance of the indicator that has a custom button embedded within its code. Hence, I assume that each tab will have its own unique instance of the button that will show up on the control window bar. I included a snippet of the code above pertaining to the button. Let me go thru the links you provided .and see if I can find any discrepencies.....


      thx

      Comment


        #4
        Hello pvtrader,

        Yes in that use case the sample I linked should help or could serve as a starting point. That shows how to control individual instances to allow each tab to have a script applied and not affect the others.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          HI Jesse,

          In the set of examples you gave me the closest one to what I want to achieve is the ChartToolBarCustomMenuExample. That is to say I want to attach button to toolbar. And I want the button to be functional relative to whichever tab is currently active.

          In the example "ChartToolBarCustomMenuExample" if I were to try and load an instance of the indicator for each tab, its only functional on whatever tab has the first instance of it and shows up on the toolbar. Any subsequent instances on other tabs results in the Menu button not showing up on the toolbar.


          You can replicate this by setting up a chart with multiple tabs and load the indicator in each tab to see what I am getting at............

          Comment


            #6
            Hello pvtrader,

            Those samples are set up to be more of a general demonstration of using WPF but may not match your use cases exactly. You can use the concepts from the scripts in that post in whatever ways that you needed. The ChartToolBarCustomMenuExample shows how to use the TabChangedHandler event to control removing or adding the content which is why I linked that one. You could do that in your script as well to control hiding the controls or showing them if it is or is not the selected tab.

            The indicator in the post is limited to 1 tab but the same event handler would be used for your case if you wanted to create controls based on if the tab is selected or not. If the tab is selected you could run the Insert WPF logic and if it is not selected you could instead run the Remove WPF logic. Depending on what your are adding/removing and how you do that will determine if that is limited to one tab or not. If you are using the Automation ID system that can also help to make adding and removing easier. There is a sample of using the automation ids in the ChartToolBarCustomMenuExample inside of its InsertWPFControls method.


            I look forward to being of further assistance.



            JesseNinjaTrader Customer Service

            Comment


              #7
              Hi Jesse,

              Your depth of knowledge in reference to chart controls, buttons, etc. exceeds my capacity to keep up. Thank you for your insights. In dealing with custom buttons associated with tabs, I can get by with placing the button on the price panel within the chart. I can use https://ninjatraderecosystem.com/use...bar-buttons-2/ as a starting point and take it from there.

              Thanks again!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by RookieTrader, Today, 07:41 AM
              1 response
              4 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by kujista, Today, 05:44 AM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by elderan, Yesterday, 08:03 PM
              1 response
              12 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by samish18, Yesterday, 08:57 AM
              8 responses
              25 views
              0 likes
              Last Post samish18  
              Started by DJ888, 04-16-2024, 06:09 PM
              3 responses
              10 views
              0 likes
              Last Post NinjaTrader_Erick  
              Working...
              X