• 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

Instrument List Dialog

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

    Instrument List Dialog

    I'd like to create a dialog that will show all Instrument Lists and allow the user to select a list. I had a look at the Instrument List dialog, and created an instance of the dialog, but I'm not sure how to make the changes to it. Can this be modified to return the selected list, and remove the right hand column that shows the instruments and apply button?
    Last edited by Matts; 01-20-2019, 01:57 AM. Reason: was incorrect

    #2
    Hello Matts,

    Well, there is an InstrumentSelector object, was this what you were looking at?
    https://ninjatrader.com/support/help...ntselector.htm

    But I'm not aware of a documented InstrumentList dialog window in the help guide. If are certain this is documented, may you provide a link?
    (Are you referring to the Instruments window from the Tools menu? Or are you referring to code in an addon?)

    It is possible to return a list of all instrument lists using undocumented code.
    https://ninjatrader.com/support/foru...nstrument-list

    Or find an instrument list by name and loop through its instruments also using undocumented code.
    https://ninjatrader.com/support/foru...getinstruments

    And then you could create your own control for this. Your control could be a ListView that shows the instruments in the selected list.
    Last edited by NinjaTrader_ChelseaB; 01-20-2019, 07:42 PM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks Chelsea, the dialog I had loaded is from Tools > Instrument Lists, which isn't in the documentation. I now created a control using ListView inside an NTWindow. I was able to return a list of all instrument lists. The only problem is that the list names don't show in the window after it loads. What's the best way to add a ListView to an NTWindow?

      Comment


        #4
        Hello Matts,

        The Tools > Instruments window is not an open source script that you can add to another window. This window (and all of the other windows for NinjaTrader) are part of the core application and the code is protected.

        Any addon you would be creating would use custom created code.
        Below is a link to an example of the shell of an addon.
        http://ninjatrader.com/support/forum...059#post477059

        NinjaTrader provides a few controls that you can use in your addon. Anything else you would need to custom create using general C# code.
        https://ninjatrader.com/support/help...s/controls.htm

        I am including public links to 3rd party websites that discuss listviews found through a google search.
        https://www.dotnetperls.com/listview-wpf
        https://www.c-sharpcorner.com/Upload...stview-in-wpf/
        https://docs.microsoft.com/en-us/dot...ramework-4.7.2

        You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.


        Are you adding each instrument to the list view items after the page loads?


        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I've created the ListView with XAML, but can't find a way to set the Binding of the list to the ItemSource, and DataMemberBinding like in the example - https://www.dotnetperls.com/listview-wpf I tried creating the binding in code, as it seems DataContext isn't available, but it didn't work. The grid loads, but the names aren't displayed. How can the binding be created to display the name field? I'm not planning to add the instruments to this list view, but I might do this at a later time.

          Comment


            #6
            Hello Matts,

            I wouldn't be able to assist with binding. This thread will remain open for any community members that would like to assist.

            You could loop through the instruments or collection and add each element to the ListView with <ListView>.Items.Add().

            Below is a public link to the Microsoft documentation.
            https://docs.microsoft.com/en-us/dot...ramework-4.7.2
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Thanks for your help. I figured it out now. I had some other issues that were preventing the binding from working, and I was able to use ItemsSource, with a ListBox.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by bankavaselina, Today, 10:38 AM
              0 responses
              5 views
              0 likes
              Last Post bankavaselina  
              Started by dieterp, Today, 09:40 AM
              1 response
              6 views
              0 likes
              Last Post NinjaTrader_Heath  
              Started by bankavaselina, Today, 08:51 AM
              1 response
              13 views
              0 likes
              Last Post NinjaTrader_PatrickG  
              Started by ballboy11, Today, 09:05 AM
              1 response
              6 views
              0 likes
              Last Post NinjaTrader_Jim  
              Started by frankduc, Today, 08:39 AM
              4 responses
              15 views
              0 likes
              Last Post frankduc  
              Working...
              X