Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Automate Additional Contract Change in State.Configure

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

    Automate Additional Contract Change in State.Configure

    Hello, I have been running an automated strategy for a couple months now, and I was wondering if there is a way to automate the change of:
    Code:
    AddDataSeries("MNQ 09-24", BarsPeriodType.Tick, 1);
    I am running a strategy based on ES and NQ mini data, while entering on ES, NQ, MES, MNQ. I am wondering if there is a way to automate the adding of the micro contracts after they expire. Obviously this won't work, but something along the lines of:
    Code:
    AddDataSeries("M" + null, BarsPeriodType.Tick, 1);
    Let me know if anything needs clarification, thank you

    #2
    Hello rbeckmann05,

    Thank you for your post.

    Adding data series dynamically is not supported, unfortunately. Any added data series must be hard-coded. From the Help Guide:

    "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."



    Additionally, there is no way to rollover contracts when they expire programmatically. You must manually rollover to the new expiry.

    Please let us know if you have any other questions. ​

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    30 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    48 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    38 views
    0 likes
    Last Post CarlTrading  
    Working...
    X