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 TheMarlin801, 10-13-2020, 01:40 AM
            20 responses
            3,914 views
            0 likes
            Last Post Bidder
            by Bidder
             
            Started by timmbbo, 07-05-2023, 10:21 PM
            3 responses
            151 views
            0 likes
            Last Post grayfrog  
            Started by Lumbeezl, 01-11-2022, 06:50 PM
            30 responses
            808 views
            1 like
            Last Post grayfrog  
            Started by xiinteractive, 04-09-2024, 08:08 AM
            3 responses
            11 views
            0 likes
            Last Post NinjaTrader_Erick  
            Started by Johnny Santiago, 10-11-2019, 09:21 AM
            95 responses
            6,194 views
            0 likes
            Last Post xiinteractive  
            Working...
            X