• 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

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 Botan626, Today, 04:43 AM
        0 responses
        4 views
        0 likes
        Last Post Botan626  
        Started by xsgex, Yesterday, 09:46 PM
        0 responses
        3 views
        0 likes
        Last Post xsgex
        by xsgex
         
        Started by Steve L, Yesterday, 09:36 PM
        0 responses
        6 views
        0 likes
        Last Post Steve L
        by Steve L
         
        Started by krugman25, Yesterday, 09:34 PM
        0 responses
        4 views
        0 likes
        Last Post krugman25  
        Started by indy73, Yesterday, 04:42 PM
        0 responses
        15 views
        0 likes
        Last Post indy73
        by indy73
         
        Working...
        X