Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Copy Instrument from List A to List B

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

    Copy Instrument from List A to List B

    hello,
    some small question today.

    How can i copy with a C# script an instrument from instrument list "A" to instrument list "B" when a condition/indicator is TRUE, for example ?



    thank you.

    Stefan

    #2
    Hello galieo,

    Thank you for your inquiry and welcome to the NinjaTrader Support Forum!

    To clarify, are you wishing to dynamic add instruments to an instrument list through code? Unfortunately, you would not be able to do this.

    However, we do have undocumented code here that will allow you to loop through an instrument list:
    Code:
    // ensure to change "Default" to the name of the instrument list you are trying to access
    NinjaTrader.Cbi.InstrumentList listOfInstruments = NinjaTrader.Cbi.InstrumentList.GetObject("Default");
    
    foreach (Instrument instrument in listOfInstruments.Instruments)
    {
         // do something
    }
    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      That would be a useful command for scripting. As it is not possible, just use the output window with a print command when your condition is true. After processing your instrument list copy the output window contents and paste into File | Utilities | Import Stock Symbol List.
      Print (Instrument.FullName + ",")

      Comment


        #4
        Hello AbcRocks,

        Thank you for your reply and welcome to the NinjaTrader Support Forum!

        I just wanted to clarify that utilizing Import Stock Symbol List will not accomplish what galieo has asked.

        This utility allows one to import a list of stock symbols for adding instruments to the Instrument Manager in bulk.

        These instruments will already exist in the Instrument Manager.

        For more information about using this utility, please take a look at this link in the NinjaTrader help guide: http://ninjatrader.com/support/helpG...stock_symb.htm
        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          Hello,
          I should have been more specific:
          When importing the list of stocks using the import utility, specify which instrument list you wish the list to go into. You may also specify a new list if desired. The list will then be imported into your desired instrument list.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          559 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          324 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
          546 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          547 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X