Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

[Request] - ChartTrader access

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

    [Request] - ChartTrader access

    Hello,

    In NT7 it was possible to access the ChartTrader and had some custom buttons and so on, I was doing this with a
    Control ctrader = ChartControl.Controls["pnlChartTrader"].Controls["ctrChartTraderControl"];
    but it won't work anymore.
    Is there any trick/method/idea to access this object?

    Thanks,
    Sam

    #2
    Originally posted by sam028 View Post
    Hello,

    In NT7 it was possible to access the ChartTrader and had some custom buttons and so on, I was doing this with a
    Control ctrader = ChartControl.Controls["pnlChartTrader"].Controls["ctrChartTraderControl"];
    but it won't work anymore.
    Is there any trick/method/idea to access this object?

    Thanks,
    Sam
    +1 for sample.. please please


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

    Comment


      #3
      Hi Sam,

      This is outside of the relm of support for NinjaTrader 7, however, this thread will remain open for any community members that would like to assist.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        I understand, I don't need on NinjaTrader 7, but how to access, or if it's possible to access, to the new ChartTrader in NT8.
        I presume could write an NT8 Addon which will do basically the same thing (select accounts, ATM box, buttons, ...) but there is maybe an easiest way.

        Comment


          #5
          There would need to be an automation ID for this control which does not currently exist in B2. We're looking into this for B3 - #8406
          MatthewNinjaTrader Product Management

          Comment


            #6
            Actually, I misspoke - there is an automation ID for chart trader already. The attached should get you started on Beta 2.
            Attached Files
            MatthewNinjaTrader Product Management

            Comment


              #7
              Originally posted by NinjaTrader_Matthew View Post
              Actually, I misspoke - there is an automation ID for chart trader already. The attached should get you started on Beta 2.
              Wow.. What a major pain in the you know what was that to format!!

              But thank you very much for that!!! Adding everything to a new grid and than that grid to the main grid was the major component there I was missing.

              Although I do see that this acts just like the sample button code, in that it is not tab specific.. Is this to be expected?


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

              Comment


                #8
                Excuse my ignorance here, but I'm still trying to get my head around dependency objects, UIElements, and automation ids.. This is a little off topic, but since were talking about ChartTrader here, figured as good a place as any to ask..

                Is there a reason why this works..

                Code:
                [COLOR=#080808]
                NTMenuItem [/COLOR][COLOR=#080808]myCTM[/COLOR][COLOR=#000000] = [/COLOR][COLOR=#080808]Window[/COLOR][COLOR=#000000].[/COLOR][COLOR=#080808]GetWindow[/COLOR][COLOR=#000000]([/COLOR][COLOR=#080808]ChartControl[/COLOR][COLOR=#000000].[/COLOR][COLOR=#080808]Parent[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#080808]FindFirst[/COLOR][COLOR=#000000]([/COLOR][COLOR=#b22222]"ChartWindowMenuChartTraderMenuItem"[/COLOR][COLOR=#000000]) [/COLOR][COLOR=#0000ff]as [/COLOR][COLOR=#080808]NTMenuItem[/COLOR][COLOR=#000000];[/COLOR]
                and this doesn't..

                Code:
                [COLOR=#080808]
                NTMenuItem [/COLOR][COLOR=#080808]myCTMI[/COLOR][COLOR=#000000] = [/COLOR][COLOR=#080808]Window[/COLOR][COLOR=#000000].[/COLOR][COLOR=#080808]GetWindow[/COLOR][COLOR=#000000]([/COLOR][COLOR=#080808]ChartControl[/COLOR][COLOR=#000000].[/COLOR][COLOR=#080808]Parent[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#080808]FindFirst[/COLOR][COLOR=#000000]([/COLOR][COLOR=#b22222]"ChartWindowMenuChartTraderMenuItemOpen"[/COLOR][COLOR=#000000]) [/COLOR][COLOR=#0000ff]as [/COLOR][COLOR=#080808]NTMenuItem[/COLOR][COLOR=#000000];[/COLOR]
                Is it because the Open is actually an item of the MenuItem? By declaring the first statement, and using a foreach with AutomationProperties.GetAutomationId, or even GetItemAt(index) I can get, use, and see it's there.. But would really like to do this in a one liner if possible.. I've tried all kinds of various ways to do this, but have yet to be successful..

                What am I missing here, and/or Is a one liner for this possible?


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

                Comment


                  #9
                  Originally posted by -=Edge=- View Post
                  Although I do see that this acts just like the sample button code, in that it is not tab specific.. Is this to be expected?
                  B3 will expose a SelectionChangedEventArgs that you can hook onto to notify your script when the main chart window's tab control has changed, allowing you to hide the button if the user tabs away from the chart control which the indicator is running from.

                  Originally posted by -=Edge=- View Post
                  Is it because the Open is actually an item of the MenuItem?
                  Yes, to my knowledge. The submenu wouldn't exist until you have the parent object. I'm not aware of a way to get this in one line. But if you find something, please do share.
                  MatthewNinjaTrader Product Management

                  Comment


                    #10
                    There is a one liner for opening the window, outside of the automation framework:

                    Code:
                    NinjaTrader.Gui.Chart.ChartHelper.SetChartTraderVisibility(this.ChartControl, ChartTraderVisibility.Visible);
                    MatthewNinjaTrader Product Management

                    Comment


                      #11
                      Originally posted by NinjaTrader_Matthew View Post
                      Yes, to my knowledge. The submenu wouldn't exist until you have the parent object. I'm not aware of a way to get this in one line. But if you find something, please do share.
                      From further reading and research, I guess this will not be possible after all.. the (NTMenuItem).Items (type is ItemsCollection) implements the IEnumerable Interface, but does not implement the IQueryable interface, and cannot invoke the AsQueryable method.. So I guess 2 lines is the best we'll be able to do..




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

                      Comment


                        #12
                        I've added just a couple lines to the original SampleAddChartTraderButton.cs.. Testing access to automation ids.. Add this to any chart, with or without chart trader open, and make sure that all the buttons of the toolbar are visible.. Works just fine and you'll see a couple lines print in your output window..

                        Now reduce the chart size so that the chart trader button is not visible and ends up in the overflow of the toolbar.. Hit F5 and/or Reload the indicator and you will receive an exception.. Object reference not set to instance of object..

                        Should this behavior be expected.. If so, does this mean the submenu's of the button (NTMenuItem) will never be accessible unless the chart size is big enough that the Button does not end up in the overflow of the toolbar???


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

                        Comment


                          #13
                          Checking with development on expected behavior/how to handle - NTEIGHT-8431
                          MatthewNinjaTrader Product Management

                          Comment


                            #14
                            The menu item was moving to another visual tree when collapsed. This scenario will be fixed in B3 where the extension method has been updated to find the menu item if it is collapsed.
                            MatthewNinjaTrader Product Management

                            Comment


                              #15
                              Would it be possible to have an Indicator to load a xaml file and then change the ChartTrader look & feel?
                              I presume it would be possible if the Indicator class could inherit from NTWindow or NTTabPage but it's not possible (BTW that's doesn't sounds crazy).
                              Or is the good option is to avoid the idea and create an Addon instead, which will be linked to a chart?

                              Thanks,
                              Sam

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by traderqz, Today, 12:06 AM
                              10 responses
                              18 views
                              0 likes
                              Last Post traderqz  
                              Started by algospoke, 04-17-2024, 06:40 PM
                              5 responses
                              46 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by arvidvanstaey, Today, 02:19 PM
                              1 response
                              6 views
                              0 likes
                              Last Post NinjaTrader_Zachary  
                              Started by mmckinnm, Today, 01:34 PM
                              3 responses
                              5 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by f.saeidi, Today, 01:32 PM
                              2 responses
                              8 views
                              0 likes
                              Last Post f.saeidi  
                              Working...
                              X