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 yertle, Yesterday, 08:38 AM
                7 responses
                28 views
                0 likes
                Last Post yertle
                by yertle
                 
                Started by bmartz, 03-12-2024, 06:12 AM
                2 responses
                19 views
                0 likes
                Last Post bmartz
                by bmartz
                 
                Started by funk10101, Today, 12:02 AM
                0 responses
                3 views
                0 likes
                Last Post funk10101  
                Started by gravdigaz6, Yesterday, 11:40 PM
                1 response
                8 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by MarianApalaghiei, Yesterday, 10:49 PM
                3 responses
                10 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Working...
                X