Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Automating Contract Rollover For Secondary Data Series

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

    Automating Contract Rollover For Secondary Data Series

    Hi there,

    I have a strategy that uses the NQ data series for entry criteria and a secondary MNQ data series for trade execution.

    The NQ data series is straightforward for users because they can easily roll it over on the chart itself (e.g., from NQ 12-24 to NQ 03-25).

    However, the issue lies with the secondary MNQ data series.

    Since the code is protected, users cannot manually update the secondary MNQ data series (e.g., from MNQ 12-24 to MNQ 03-25) when the contract expires.

    I’m looking for a solution where the MNQ contract can either:
    1. Automatically roll over to the new contract when the old one expires, or
    2. Be configurable as a property in the strategy's UI, allowing users to manually select or update the MNQ contract.

    Are there any built-in methods or workarounds that you would recommend for this functionality?

    Any help or insights would be greatly appreciated! Thank you.

    #2
    Hello RoswellTrader,

    Thank you for your post.

    This would require an unsupported workaround. You would need to supply a variable to AddDataSeries() and call it dynamically. For example, getting the instrument and expiry as below and supplying the variable to the AddDataSeries() call.

    Code:
    string masterName = "MNQ";
    myInstrument = Instrument.GetInstrument(masterName + Instrument.GetInstrument(masterName + " ##-##").MasterInstrument.GetNextExpiry(DateTime.Now). ToString(" MM-yy"));
    Please note that this will work for something added to a chart, but will break the Strategy Analyzer.

    ​A supported workaround would be to use a BarsRequest to fetch data instead, and push the data to a custom series.

    Below is a sample script which demonstrates using a BarsRequest.



    Please let me know if you have further questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    87 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    128 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    65 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    117 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X