Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Live strategy behavior around rollover

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

  • uday12
    replied
    Thanks Chelsea, very helpful.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    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.
    Shows a button on the chart to roll the expiry to the next available contract month. Option to hide button until a number of days before or on roll date. Another option to confirm by opening the instrument overlay selector or automatically rollover without confirmation. (Update June 27th, 2019 – Added an option to show […]



    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.

    Leave a comment:


  • uday12
    replied
    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 ?

    Thanks



    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    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.



    Leave a comment:


  • uday12
    started a topic Live strategy behavior around rollover

    Live strategy behavior around rollover

    Hi,

    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?

    Thanks







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

Latest Posts

Collapse

Topics Statistics Last Post
Started by KennyK, 05-29-2017, 02:02 AM
3 responses
1,282 views
0 likes
Last Post NinjaTrader_Clayton  
Started by AttiM, 02-14-2024, 05:20 PM
11 responses
184 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by fernandobr, Today, 09:11 AM
1 response
3 views
0 likes
Last Post NinjaTrader_Erick  
Started by timmbbo, Today, 08:59 AM
1 response
3 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by itrader46, Today, 09:04 AM
1 response
6 views
0 likes
Last Post NinjaTrader_Clayton  
Working...
X