Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Instrument List

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

    Instrument List

    works fine
    ......
    if (this.listAll != null)
    {
    this.listAll = null;
    }
    string MyList = "MyAtivosCompra";//an existing list in NT

    this.listAll = new NinjaTrader.Cbi.InstrumentList();
    this.listAll = NinjaTrader.Cbi.InstrumentList.GetObject(MyList);


    foreach (Instrument i in listAll.Instruments)
    {
    Print("all " + i.FullName);//it is ok!
    }
    As I said this is working fine but I would like to load all Instrument lists such as Default, etc, and then select the one I want to use. Any ideas?

    #2
    Hello,

    Looping through the instrument lists is not supported by NinjaTrader.

    That said you might try:
    foreach (NinjaTrader.Cbi.Instrument list in NinjaTrader.Cbi.InstrumentList)
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I got an error, NinjaTrader.Cbi.InstrumentList is a type .... In fact I need to get the FullName of all instruments lists, so I can select which one I will use.

      Comment


        #4
        Hi JFranco,

        Try:

        foreach (NinjaTrader.Cbi.InstrumentList list in NinjaTrader.Cbi.InstrumentList)
        {
        Print(list.Name);
        foreach (NinjaTrader.Cbi.Instrument instrument in list)
        {
        Print(instrument.FullName);
        }
        }
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I got 'NinjaTrader.Cbi.InstrumentList' é um 'tipo', que não é válido no contexto especificado
          or in English something like
          'NinjaTrader.Cbi.InstrumentList' is a 'type', not valid in specified context

          Comment


            #6
            Hi JFranco,

            I gave this a try but it looks like this will not be possible as the NinjaTrader.Cbi.InstrumentList is not a collection that you can loop through.

            Instead you will have to pass a string with the name of the list you are looking for.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              JFranco,

              I take that back.

              foreach (Cbi.InstrumentList list in Cbi.InstrumentList.GetObjects())
              {
              Print(list.Name);
              foreach (Cbi.Instrument instrument in list.Instruments)
              {
              Print(instrument.FullName);
              }
              }

              Seems to work.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Thanks a lot, works fine.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                110 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                59 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                37 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                41 views
                0 likes
                Last Post TheRealMorford  
                Started by Mindset, 02-28-2026, 06:16 AM
                0 responses
                78 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Working...
                X