• 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 NinjaCustomer, Today, 12:14 AM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Marco  
          Started by U0000999, Yesterday, 11:49 PM
          0 responses
          4 views
          0 likes
          Last Post U0000999  
          Started by ahadari28, Yesterday, 04:01 PM
          0 responses
          6 views
          0 likes
          Last Post ahadari28  
          Started by TazoTodua, Yesterday, 06:00 AM
          2 responses
          19 views
          0 likes
          Last Post TazoTodua  
          Started by TazoTodua, Yesterday, 09:06 AM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X