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 NullPointStrategies, Today, 05:17 AM
    0 responses
    41 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    124 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    64 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    41 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X