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 AaronKoRn, Today, 09:49 PM
                0 responses
                2 views
                0 likes
                Last Post AaronKoRn  
                Started by carnitron, Today, 08:42 PM
                0 responses
                8 views
                0 likes
                Last Post carnitron  
                Started by strategist007, Today, 07:51 PM
                0 responses
                9 views
                0 likes
                Last Post strategist007  
                Started by StockTrader88, 03-06-2021, 08:58 AM
                44 responses
                3,975 views
                3 likes
                Last Post jhudas88  
                Started by rbeckmann05, Today, 06:48 PM
                0 responses
                9 views
                0 likes
                Last Post rbeckmann05  
                Working...
                X