Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Programmatically Access instrument list

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

    Programmatically Access instrument list

    Hi

    How does one programmatically Access an instrument list?

    I need a strategy to load a list of instruments and instead of hardcoding or reading from a file I would like to add from an instrument list.

    Thanks

    Mike

    #2
    Hi Mike, unfortunately the instruments lists could not be accessed programmatically.

    Comment


      #3
      Have been doing a little snooping around using the object browser in Visual Studio and have figured it out.

      NinjaTrader.Cbi.InstrumentList list = NinjaTrader.Cbi.InstrumentList.GetObject("FX");

      foreach (Instrument i in list.Instruments) {
      Add(i.FullName, PeriodType.Minute, 60);
      }

      Cheers

      Mike

      Comment


        #4
        Thanks for this example, upshon. The ForEach loop generates an "Object Reference not set to instance of an object" error... What's missing?

        I did add a using declaration for Ninjatrader.Cbi.

        Thanks.
        Last edited by Ricam; 03-20-2012, 01:45 PM.

        Comment


          #5
          NinjaTrader.Cbi.InstrumentList list = NinjaTrader.Cbi.InstrumentList.GetObject("FX");

          FX is the name of the custom list I created, I suspect you need to change this with a let you have.

          Comment


            #6
            Would you be kind enough to provide additional information on how you did this, I unfortunately am at a dead end. How was list created, where is it located, does a reference need to be added to be able to find it, etc. Thanks

            Comment


              #7
              Go to Tools Menu then select "Instrument Manager"

              There is a drop down called "Instrument Lists", there you can create new lists or manage the contents of existing lists.

              Use the name of the "Instrument Lists" as the parameter in

              NinjaTrader.Cbi.InstrumentList list = NinjaTrader.Cbi.InstrumentList.GetObject("FX");

              Comment


                #8
                Thanks upshon, that did it.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                579 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                334 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                101 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                554 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                551 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X