• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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 Seeker of Alpha, Today, 06:17 PM
          0 responses
          8 views
          0 likes
          Last Post Seeker of Alpha  
          Started by gtheaded, Today, 03:47 PM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_Tyler  
          Started by TAJTrades, Today, 03:25 PM
          0 responses
          5 views
          0 likes
          Last Post TAJTrades  
          Started by DTSSTS, Today, 01:26 PM
          0 responses
          8 views
          0 likes
          Last Post DTSSTS
          by DTSSTS
           
          Started by RFrosty, Today, 01:20 PM
          0 responses
          25 views
          0 likes
          Last Post RFrosty
          by RFrosty
           
          Working...
          X