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

How can Ninjascript AddDataSeries reference a symbol universally

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

    How can Ninjascript AddDataSeries reference a symbol universally

    How do I code Ninjascript AddDataSeries to reference a symbol without referencing its expiration date so it rolls over without code change.

    #2
    Hello ProfitPilgrim,

    Thanks for your post.

    You can use an overload that does not use a string to describe the instrument name, or you can use null for the instrument name to use the instrument of the primary data series. This is noted in the Warnings section of the AddDataSeries documentation page. I've requested that this gets moved to Tips so it is easier to find.

    Publicly available AddDataSeries documentation can be found here - https://ninjatrader.com/support/help...dataseries.htm

    If you are adding additional data series of other futures contracts, the full expiry must be used.

    Please let me know if you have any additional questions.
    JimNinjaTrader Customer Service

    Comment


      #3
      Thanks Jim. Do I correctly understand that whenever the rollover date of added symbols in accustom indicator is reached, the indicator will stop working correctly until the code is modified, effectively every 1 to 3 months? As a vendor, that is awkward for clients leasing as they will all have to be updated with new code whenever added symbols rollover. Is there an alternative?

      Comment


        #4
        Hello ProfitPilgrim,

        If "null" is passed as the instrument name, it will grab the instrument of the primary data series. The client should only have to hit the Rollover button to rollover and load the new front month. Once the chart is reloaded with the new front month, each NinjaScript will then be reloaded. Since the primary data series is updated and the script calls AddDataSeries(null, Data.BarsPeriodType.Minute, 5); or similar, the newly rollover Contract month will be used. You should not have to perform any additional work to update the script for the client.

        Let me know if there is anything else I can do to help.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by sidlercom80, 10-28-2023, 08:49 AM
        168 responses
        2,262 views
        0 likes
        Last Post sidlercom80  
        Started by Barry Milan, Yesterday, 10:35 PM
        3 responses
        10 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by WeyldFalcon, 12-10-2020, 06:48 PM
        14 responses
        1,429 views
        0 likes
        Last Post Handclap0241  
        Started by DJ888, 04-16-2024, 06:09 PM
        2 responses
        9 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        41 views
        0 likes
        Last Post jeronymite  
        Working...
        X