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

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.
    Chris L.NinjaTrader Customer Service

    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.
        Chris L.NinjaTrader Customer Service

        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 Shansen, 08-30-2019, 10:18 PM
            24 responses
            938 views
            0 likes
            Last Post spwizard  
            Started by Max238, Today, 01:28 AM
            0 responses
            3 views
            0 likes
            Last Post Max238
            by Max238
             
            Started by rocketman7, Today, 01:00 AM
            0 responses
            2 views
            0 likes
            Last Post rocketman7  
            Started by wzgy0920, 04-20-2024, 06:09 PM
            2 responses
            27 views
            0 likes
            Last Post wzgy0920  
            Started by wzgy0920, 02-22-2024, 01:11 AM
            5 responses
            32 views
            0 likes
            Last Post wzgy0920  
            Working...
            X