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

"Dynamic" Rollover

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

    "Dynamic" Rollover

    Hi,
    I have to add on State.Cnfigure new dataseries
    else if (State == State.Configure)
    {
    AddDataSeries(sInstrument1,BarsPeriodType.Minute, 1); // this is bar series xxx ....

    And I previously define
    private string sInstrument1 = "ES 03-23";

    I can find a lot of information using
    private SessionIterator sessionIterator; well, After i define my dataseries.

    Question is that possible to figure out that i need to switch to "ES 06-23" "dynamically" as this action has to be done before State.Configure obviously using code?

    -PNF.


    #2
    Hello PNF,

    Thank you for your post.

    The following note from the AddDataSeries() page in the help guide is relevant here:
    "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.​"

    With that said, you could try the suggestion in the following forum post where you write a method that fetches the current expiry in the NinjaTrader database based on the symbol name:
    I'm creating a strategy that will include a AddDataSeries of MES 1-minute. Strategy builder has taken care of the details of that. I'm wondering what happens at expiry? When we roll over to a new contract symbol, since the strategy must be compiled before running, will the code need to be edited and recompiled manually?


    Otherwise, you would need to manually adjust your AddDataSeries() logic when you are ready to roll over, then compile and re-load the strategy to pick up the changes.

    Please let us know if we may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      Well, i have read this note to AddDataSeries that was one of the reason to ask question to begin with, and yes, i'm using something similar to the post indicated. As note is type of "limitation" (without discussion is or is not) i would have to end-up with data series that i do not need to run strategy, they will be "there", consuming resources and memory, as i additionally would like to know Volume, and there is no way to get this w/o having bars loaded. Because of this i have a question what is the reasonable limit of have many data series i can load, outside of the obvious answer - depending on your hardware.
      -PNF

      Comment


        #4
        Hello PNF,

        Thank you for your reply.

        There is no "reasonable limit" that I would be able to quote; it is not a magic number and it truly depends on your PC resources as well as the calculations and demand from the script itself. You would have to keep the NinjaScript Best Practices in mind as well as Performance Tips which can both be found in the help guide:Please let us know if we may be of further assistance.
        Emily C.NinjaTrader Customer Service

        Comment


          #5
          Thank you.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by benmarkal, Yesterday, 12:52 PM
          3 responses
          23 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by helpwanted, Today, 03:06 AM
          1 response
          19 views
          0 likes
          Last Post sarafuenonly123  
          Started by Brevo, Today, 01:45 AM
          0 responses
          11 views
          0 likes
          Last Post Brevo
          by Brevo
           
          Started by pvincent, 06-23-2022, 12:53 PM
          14 responses
          244 views
          0 likes
          Last Post Nyman
          by Nyman
           
          Started by TraderG23, 12-08-2023, 07:56 AM
          9 responses
          388 views
          1 like
          Last Post Gavini
          by Gavini
           
          Working...
          X