• 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

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.
    BertrandNinjaTrader Customer Service

    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 timur, Today, 07:49 AM
                0 responses
                2 views
                0 likes
                Last Post timur
                by timur
                 
                Started by stoner, Today, 06:44 AM
                1 response
                8 views
                0 likes
                Last Post NinjaTrader_Jim  
                Started by timur, Today, 06:39 AM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_Jim  
                Started by CougarMountain, Yesterday, 03:55 PM
                1 response
                12 views
                0 likes
                Last Post NinjaTrader_PaulH  
                Started by syxforex, Today, 12:11 AM
                1 response
                10 views
                0 likes
                Last Post NinjaTrader_PaulH  
                Working...
                X