Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

loading instruments list INSIDE script

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

    loading instruments list INSIDE script

    Hi,

    I would like to load a whole instruments list INSIDE my script, rather than hardcoding adding hundreds or thousands of stocks line by line in my code. I need to use the data from all of them at once to construct my strategy. To be clear, I am not just trying to run a single-instrument strategy on a whole list of instruments (this I know how to do).

    Do you have some sample code that can demonstrate this?
    Thanks

    #2
    Protis, there would be unfortunately nothing supported for loading a complete instrument list in, however we have this on our list of feedback collected. I will make sure to add a vote on your behalf in to this item as well, for now an Add() line in Initializer() for your instruments desired would be needed as shown in our SampleMultiInstrument strategy shipped with NT.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks Bertrand.

      Perhaps if I loaded a file that contained the ticker names, I could code a loop which would call Add() on each ticker? This way I wouldn't need to hardcode a massive list of Add() calls..

      Is this possible? And if so, is there any sample code available that might help me?

      Thanks!

      Comment


        #4
        Protis, you could be looking into this snippet here, although this is not a technique we officially could support -

        NinjaTrader.Cbi.InstrumentList list1 = NinjaTrader.Cbi.InstrumentList.GetObject("your instrument list string");

        foreach (Instrument i in list1.Instruments)
        {
        Add(i.FullName, PeriodType.Minute, 1); // add your type and period here
        }
        BertrandNinjaTrader Customer Service

        Comment


          #5
          thank you very much!!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by bill2023, Yesterday, 08:51 AM
          8 responses
          43 views
          0 likes
          Last Post bill2023  
          Started by yertle, Today, 08:38 AM
          6 responses
          25 views
          0 likes
          Last Post ryjoga
          by ryjoga
           
          Started by algospoke, Yesterday, 06:40 PM
          2 responses
          24 views
          0 likes
          Last Post algospoke  
          Started by ghoul, Today, 06:02 PM
          3 responses
          16 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          46 views
          0 likes
          Last Post jeronymite  
          Working...
          X