Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

instrument dataseries automatic update

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

    instrument dataseries automatic update

    What I want to do is to automatically update my dataseries.

    AddDataSeries(sInstrumentName);

    // IE: lets say my instrument name is CL 11-18 what I want to do is to see what the Active future is and replace the CL 11-18 to CL 12-18 automatically. Same with NQ 12-18 to NQ 03-18

    #2
    Hello ballboy11,

    Thanks for the post.

    Currently, it is recommended to use only hardcoded values for instrument names in AddDataSeries().

    A note from that page:

    "Arguments supplied to AddDataSeries() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input). Attempting to add a data series dynamically is NOT guaranteed and therefore should be avoided. Trying to load bars dynamically may result in an error similar to: Unable to load bars series. Your NinjaScript may be trying to use an additional data series dynamically in an unsupported manner."
    A simple workaround would be to refactor the code by using the search+replace all feature in the NInjaScript editor.

    Please let me know if I can assist further.

    Comment


      #3
      The implications of that is a vendor has to manually update the instrument's contract month in the AddDataSeries() line of code, compile a new indicator/strategy version, and then send it out to all the customers.
      So a new indicator version must be created every time a contract rolls over to the next contract???

      I hope you guys understand thats a lot of unnecessary work on the vendors and more importantly the customers.

      Comment


        #4
        Hello,

        Thanks for the follow-up.

        I was able to use a string input property and add a secondary series with that. Doing this is just unsupported so it would need to be done at one's own risk. Also, if you are looking to add a series where the instrument is the same as the primary series with a different time period, you can just pass "null" for the instrument name, and that will add a series of the primary series.

        For the instrument name parameter null could be passed in, resulting in the primary data series instrument being used.
        Please let me know if I can assist further.

        Comment


          #5
          • zacharydw00 I agree with you with the updates. I do have a rolloverindicator that tells the date of the rollover. I know I can write the string in my parameters but what i wanted to find the current future. I am trying to make it user friendly in order the user doesn't have to type in a typo error

          Comment


            #6
            There must be a typecast for the insturments one can add as a dropdown

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            580 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            335 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            102 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            554 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            552 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X