• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.


No announcement yet.

Partner 728x90


Live strategy behavior around rollover

  • Filter
  • Time
  • Show
Clear All
new posts

    Live strategy behavior around rollover


    I want to understand live strategy behavior around rollover.

    Situation: I am trading "ES 06-19" and I have a live contract position of long 5 contracts, and there are 8 calendar days to maturity, and I would like to rollover from "ES 06-19" to "ES 09-19" for the same 5 contracts on 23 hours window (6pm-5pm EST).

    Option 1:

    (a) Around the rollover dates, close / disable the strategy completely in NT (e.g in control center strategies tab), and close out all positions

    (b) Restart / re-enable the strategy on the new contract.

    Option 2:

    (a) Manually end of the day, I put in a sell / buy orders of "ES 06-19" / "ES 09-19" on the broker's platform, sometime before 5pm.

    (b) Since I am running the strategy on 23 hours, between 5pm-6pm EST, I manually change the strategy in NT to run on "ES 09-19" instead of "ES 06-19".

    What settings for "StartBehavior" do I need? Should I set "StartBehavior = StartBehavior.AdoptAccountPosition" ?

    Option 3:

    (a) I run my strategy on a continuous contract. For instance, I am subscribed to IQ Feed, which has a continuous symbol "@ES #C". To do this, I add a new "instrument" via the instrument tab, say "ES_Cont" that is mapped to IQ Feed's "@ES #C"

    (is this even possible?? I tried to add a new instrument with name as "ES_C" as a future, and mapped it to "@ES#C" in IQ Feed, but when I tried to view it in a chart, I got an error, but when I add it as a stock, it seems to work)

    (b) I can then run the strategy on "ES_Cont", and also add "ES 06-19" and "ES 09-19", and then manually code in the rollover instructions in the code as well, such as if the price of "ES_Cont" matches with "ES 06-19" use "ES 06-19", but if it matches with "ES 09-19" do a rollover and use "ES 09-19" going forward.

    Once a quarter, during a weekend, update the strategy to add a new contract, e.g. "ES 12-19" within the strategy code.


    I wanted to check: which of Option 1, or Option 2, or Option 3 is popular, preferable etc. What has been a common practice? Recommended practice?


    Last edited by uday12; 03-31-2019, 08:17 AM.

    Hello uday12,

    I recommend thinking of the new contract as different instrument.

    Changing the contract month would prevent the strategy from matching any previously placed live trades.

    If you want the account to be in sync with the strategy when the strategy is enabled, you can use synchronize account with immediately submit or wait until flat.

    Below is a link to a forum thread that discusses start behavior.

    Chelsea B.NinjaTrader Customer Service


      Hi Chelsea,

      Thanks for the answer.

      Just to be clear, your recommendation is to (1) stop trading a contract before (or on) the rollover date when it needs to rollover to the new contract, disable the strategy, (2) re-enable the strategy on the next contract.

      How can I get the programmatically get rollover date in Ninjascript, if I want to stop or exit a contract on the date it would be needed to rollover it over to the next contract? I saw in the NT help guide, there is a RolloverCollection https://ninjatrader.com/support/helpGuides/nt8/en-us/ , but the example is very clear.

      Would it be possible for you to help me with an example where (1) if the strategy is in live mode, (2) get the "current" contract's rollover date from the Rollover collection, and (3) if today's date is the rollover date, then if there are any live positions, exit them ?



        Hello uday12,

        I would recommend closing all open positions on the old contract and enabling a new instance of the strategy on the new contract.

        The RolloverIndications indicator provides example logic for finding the next rollover. Below is a publicly available link.

        The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
        Chelsea B.NinjaTrader Customer Service


          Thanks Chelsea, very helpful.


          Latest Posts


          Topics Statistics Last Post
          Started by countjoemoney, Today, 01:16 PM
          0 responses
          Last Post countjoemoney  
          Started by fx.practic, Today, 12:59 PM
          0 responses
          Last Post fx.practic  
          Started by TheNomadicAspie, Today, 12:07 PM
          0 responses
          Last Post TheNomadicAspie  
          Started by alcorr247, Today, 12:04 PM
          0 responses
          Last Post alcorr247  
          Started by firstlanetech, Today, 11:24 AM
          1 response
          Last Post firstlanetech