Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Buttons-StackPanels-DockPanels

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

    #16
    Is it possible to add buttons with a nice GUI on the right side of the chart?

    I would like to put buttons on the right side of the chart, similar to what happens when you press the "Chart Trader" icon, and then you see a GUI/Panel that shows up on the right side of the chart.

    How can I add my own panel to a trading strategy I am using with buttons to control entry points.

    Example:
    I active my panel, and then I can click a "Short" or "Long" button, in order to activate lines in my chart that will triggers sell or buy orders that I can manually change position of?

    Comment


      #17
      Originally posted by warcious View Post
      I would like to put buttons on the right side of the chart, similar to what happens when you press the "Chart Trader" icon, and then you see a GUI/Panel that shows up on the right side of the chart.
      You will need to use some type of Dock, Stack, and/or Wrap Panel.. Positions and alignments of the panels and buttons get a bit tricky, but here's a very simple modified example from my first post that kinda works, and might help get you started..

      I say kind of, because Brett did outline an issue with this in Post #4 of this thread, and I'm not sure if that has been addressed here with B3 or not..

      Any updates on that issue outlined in Post #4???




      Note: This code does not dispose of the buttons or their events on termination, ultimately you will want to do that!
      Attached Files
      -=Edge=-
      NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

      Comment


        #18
        Originally posted by NinjaTrader_Brett View Post
        Quick update, we looked into getting the button added which is possible. However it turns out the button is on the caption bar instead of the tab. As such the button is not tab sensitive which means code needed to be added to make it tab sensitive, we have added code in beta 3 to make it possible to make the button tab sensitive like our existing buttons. However I'm doing a final review and will post back shortly as the solution is not 100% yet.
        Would it now be possible to get those tab sensitive lines of code?

        Thanks


        -=Edge=-
        NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

        Comment


          #19
          Originally posted by -=Edge=- View Post
          Would it now be possible to get those tab sensitive lines of code?

          Thanks


          The NTWindow.MainTabControl SelectionChanged event has been exposed in B3 allowing you to set the visibility of your custom controls based on the tab which is selected.

          I've modified your code which implements such functionality.
          Attached Files
          Last edited by NinjaTrader_Matthew; 07-15-2015, 02:53 PM.
          MatthewNinjaTrader Product Management

          Comment


            #20
            Originally posted by NinjaTrader_Matthew View Post
            The NTWindow.MainTabControl SelectionChanged event has been exposed in B3 allowing you to set the visibility of your custom controls based on the tab which is selected. I've modified your code which implements such functionality.
            The HTPanelTest code I posted actually applies a dockpanel and a couple buttons to the chart itself, not to NT's toolbar, and as so, it only applies the panel/buttons to the actual chart and tab that the indicator is applied too.. Your code modification doesn't really apply and is not necessary for that particular indicator.. But even so, the MainTabControl code snip-its were exactly what is needed for the toolbar button, and it works perfectly.. Thanks!!

            The issue with applying buttons/panels to the chart itself was what Brett outlined in Post #4 of this thread..

            Originally posted by NinjaTrader_Brett View Post
            I researched a bit and your approach of adding buttons directly to the chart control will not work in current form since as you might have noticed each time the panel configuration changes in the chart all children are removed. NT re-adds its own stuff but your custom buttons wont get re-added. Which means the buttons needed to be added to the caption bar (Using the automation ID or other method) or we needed to implement a feature to allow you to add buttons to the chart.
            Looks like the issue with sticking a button in the Toolbar has now been addressed and seems to work just fine..

            Have you guys discussed any further how we might get around the current issue when applying the buttons/panels directly to the chart? Last discussed was possibly giving us a dedicated grid and/or panel that we might use for that purpose, but further investigation into the best method/way of being able to do this was needed at that time..

            Any word and/or development with regards to that?


            Thanks Again for Everything!!!


            -=Edge=-
            NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

            Comment


              #21
              Thanks for pointing that out, I guess I did not review your code clearly enough. Attached is a better example.

              Originally posted by -=Edge=- View Post
              Have you guys discussed any further how we might get around the current issue when applying the buttons/panels directly to the chart? Last discussed was possibly giving us a dedicated grid and/or panel that we might use for that purpose, but further investigation into the best method/way of being able to do this was needed at that time..

              Any word and/or development with regards to that?

              The user acceptance change was cleared, but we had to push back to B4 due to the critical bugs in B3. NTEIGHT-8500
              Attached Files
              Last edited by NinjaTrader_Matthew; 07-23-2015, 02:51 PM.
              MatthewNinjaTrader Product Management

              Comment


                #22
                Originally posted by NinjaTrader_Matthew View Post
                Thanks for pointing that out, I guess I did not review your code clearly enough. Attached is a better example.




                The user acceptance change was cleared, but we had to push back to B4 due to the critical bugs in B3. NTEIGHT-8500
                About _=Edge=_ comment:
                "Last discussed was possibly giving us a dedicated grid and/or panel that we might use for that purpose, but further investigation into the best method/way of being able to do this was needed at that time."
                it's already possible to add another Grid and it seems to work, you just need to find the right parent and avoid to use the grid column dedicated for the ChartTrader.

                I have not integrated the "NTWindow.MainTabControl SelectionChanged" in my source code yet (so it was not very good, I had the same Grid whatever tab was visible) but after that things will looks good.

                Comment


                  #23
                  Originally posted by sam028 View Post
                  About _=Edge=_ comment:
                  "Last discussed was possibly giving us a dedicated grid and/or panel that we might use for that purpose, but further investigation into the best method/way of being able to do this was needed at that time."

                  it's already possible to add another Grid and it seems to work, you just need to find the right parent and avoid to use the grid column dedicated for the ChartTrader.
                  My comment was specifically towards adding anything to the chart itself (Not the toolbar and/or charttrader).. You are correct in that you can already do this in an existing and/or new grid.. But there is still one small issue to overcome as Brett had pointed out..

                  Each time the panel configuration changes in the chart all children are removed. NT re-adds its own stuff but your custom buttons/panels/grids/whatever wont get re-added.

                  An example of what is meant here can be easily demonstrated by adding the HTPanelTest sample code I posted to any chart.. You will see a couple buttons at the top right corner of the chart.. Now add any other indicator.. SMA, EMA, MACD, RSI, anything that can be selected by clicking on it on the chart.. Now click on whatever indy you added to select it, and then click the delete key to manually delete it from the chart..

                  You'll notice that the indicator gets removed, which causes the panel configuration to change, which now NT automatically reloads all it's default stuff behind the scenes, but NOT the controls you added thru your script.. So now your buttons are gone, until you reload ninjascript..

                  I believe a solution is in the works, and will hopefully be available in the next beta (crossing fingers ) ...


                  -=Edge=-
                  NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

                  Comment


                    #24
                    Originally posted by NinjaTrader_Matthew View Post
                    Thanks for pointing that out, I guess I did not review your code clearly enough. Attached is a better example.
                    OK.. seems I've run into a small problem with this code.. Although I'm not sure it's necessarily the code as much as how/when the different states in OnStateChange tend to get executed.. I say that because I think I'm noticing more problems than just this, but need to do some more troubleshooting on my end to give examples..

                    For starters.. I'm going to use your SampleAddChartButton code as an example and maybe this might save me some time troubleshooting and help clear up some other issues I might be experiencing..

                    Start NT8B3.. do NOT connect to data... Load the SampleAddChartButton to a chart.. All is well.. You can remove it, re-add it, reload ninjascript, whatever and all is well..

                    Now Connect to your DataFeed.. in my case I'm connecting to Kineticks.. I immediately get the following error...

                    Indicator 'SampleAddChartButton': Error on calling 'OnStateChange' method: You are accessing an object which resides on another thread. I.E. creating your own Brush without calling .Freeze(), or trying to access a UI control from the wrong thread without using a Dispatcher.

                    At this point, the indicator does still seem to work, But you can no longer remove it from the chart.. Well you can remove it from the indicator properties panel, but the button will remain on the chart and continue to work..

                    In this particular case, if you remove it, then add it again, it doesn't seem to duplicate the button.. In other indys because of where and how I'm doing that it actually does.. I haven't tried checking for ChartControl null in the Termination yet, but even if I did, that might get rid of the error, but not sure it would end up removing the button from the chart..

                    I guess I'm still not fully understanding and/or missing something with how and when all these States fire off... Any assistance here would be greatly appreciated..


                    -=Edge=-
                    NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

                    Comment


                      #25
                      Hello -=Edge=-,

                      I would like to confirm this issue to assist our development. However, I want to confirm you are adding a button control directly to the actual panel and not to the surrounding window.

                      May I confirm that you are adding a windows control (button) directly to the chart panel?
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #26
                        Originally posted by NinjaTrader_ChelseaB View Post
                        I would like to confirm this issue to assist our development. However, I want to confirm you are adding a button control directly to the actual panel and not to the surrounding window.
                        In the example I described in post #24, I was using the exact SampleAddChartButton.cs file that Matthew posted in post #21 of this thread... (although I can provide other examples of the same thing happening)


                        -=Edge=-
                        NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

                        Comment


                          #27
                          Hi -=Edge=-,

                          Gotcha.

                          Yes, the dispatcher needs to be used when removing as well. I've updated Matthew with the fix and he will re-post his sample.
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #28
                            Originally posted by NinjaTrader_ChelseaB View Post
                            Yes, the dispatcher needs to be used when removing as well. I've updated Matthew with the fix and he will re-post his sample.
                            That's all I needed to know, no need to repost on my account.. Will go thru all my indy's and make the appropriate changes..

                            Thanks


                            -=Edge=-
                            NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

                            Comment


                              #29
                              Has the update for this been re-posted?

                              Originally posted by NinjaTrader_ChelseaB View Post
                              Hi -=Edge=-,

                              Gotcha.

                              Yes, the dispatcher needs to be used when removing as well. I've updated Matthew with the fix and he will re-post his sample.

                              Comment


                                #30
                                Originally posted by NJA_MC View Post
                                Has the update for this been re-posted?
                                I believe Matthew updated the file in his original post #21.. Just re-download it..


                                Last edited by -=Edge=-; 08-29-2015, 03:22 PM.
                                -=Edge=-
                                NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by PaulMohn, Today, 12:36 PM
                                0 responses
                                1 view
                                0 likes
                                Last Post PaulMohn  
                                Started by love2code2trade, 04-17-2024, 01:45 PM
                                4 responses
                                38 views
                                0 likes
                                Last Post love2code2trade  
                                Started by alifarahani, Today, 09:40 AM
                                2 responses
                                14 views
                                0 likes
                                Last Post alifarahani  
                                Started by junkone, Today, 11:37 AM
                                3 responses
                                20 views
                                0 likes
                                Last Post NinjaTrader_ChelseaB  
                                Started by frankthearm, Yesterday, 09:08 AM
                                12 responses
                                44 views
                                0 likes
                                Last Post NinjaTrader_Clayton  
                                Working...
                                X