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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    62 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    134 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    75 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X