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

Running live strategy via continuous symbols

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

    Running live strategy via continuous symbols

    Reading the NT documentation, there doesn't seem to be way to automatically rollover an existing position in a brokerage account.

    I am planning to run a strategy on daily resolution with an average holding period of 3-10 days.

    From reading the forums, there can be two solutions to handle rollover:

    1. Option A

    Suppose I am long ES 06-18 in my IB account, and it is time to roll-it over to ES 09-18, I do the following steps:

    (i) a manual rollover in my IB account from ES 06-18 to ES 09-18.

    (ii) I stop the strategy currently running on ES 06-18 (say on the friday close)

    (iii) I update the NT database under "Rollover Futures Instrument" from ES 06-18 to ES 09-18 (say on the weekend)

    (iv) I re-start the strategy to run again on ES 09-18 (say on sunday evening)

    2. Option B

    Suppose I don't want to bother with the manual rollover of positions in my IB account like in Option A.

    Here is a potential Option B is trying to avoid the manual rollover in the IB (or brokerage) account. Wanted to check if this is feasible?

    Not sure if this is feasible, but potentially I run a live strategy (say the account is linked to a live IB account) on a continuous contract say ES ##-## from Kinetick (or @ES#C in the case of IQFeed), and the strategy also reads another database or a file, that contains contracts and dates for which they are valid such as:

    ES 12-18, 20180907, 20181206
    ES 09-18, 20180607, 20180906
    ES 06-18, 20180308, 20180606
    ES 03-18, 20171207, 20180307
    ...
    ...

    Then the strategy code

    (i) runs on the continuous contract, but the actual orders to IB are generated using ES 09-18 or ES 06-18 or similar specifications (not sure if this is possible)

    (ii) I also write a rollover logic in the strategy itself, such that on the rollover date, the strategy also sends an order on two different maturities (or a spread) to do a rollover - one long and one short.

    Would this be viable?

    (a) Is it possible to run a live strategy on generic contract like ES ##-## from Kinetick (or @ES#C from IQ Feed)

    (b) If yes, would it be possible to access within the strategy code, which particular expiry (like ES 09-18, or ES 06-19) does that ES ##-## access point in time?

    (c) Also, would anyone know where can I see the current rollover policy used to back-adjust contracts like ES 09-18?

    #2
    Hello uday,

    Thanks for your post!

    It is possible to run a strategy against a continuous contract, and it is possible to add additional data series to a strategy so you can trade on separate/multiple instruments. One limitation that you may encounter with Option B could involve adding your specific contract months to your strategy since it is advised to hard code the name of the instrument into the AddDataSeries() call and to avoid "dynamically" loading symbols that depend on user defined input or symbols based on the primary data series.

    NinjaTrader will not automatically rollover contracts but this can be done from the Tools > Database Management window when a new contract month is open. The default merge policy is Merge Back Adjusted which will show the front contract month on top of each previous contract month. This can be set in the Tools > Options > Market Data > Global Merge Policy.

    I've included some publicly available documentation on Multi Series NinjaScripts and NinjaTrader's merge policy. The Multi Time Frame and Instruments document provides a complete guide for creating and using a multi series NinjaScript.

    Multi Time Frame and Instruments (Important Read!) - https://ninjatrader.com/support/help...nstruments.htm

    Merge Policy - https://ninjatrader.com/support/help...rge_policy.htm

    Please let us know if you have any additional questions.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Shansen, 08-30-2019, 10:18 PM
    24 responses
    938 views
    0 likes
    Last Post spwizard  
    Started by Max238, Today, 01:28 AM
    0 responses
    3 views
    0 likes
    Last Post Max238
    by Max238
     
    Started by rocketman7, Today, 01:00 AM
    0 responses
    2 views
    0 likes
    Last Post rocketman7  
    Started by wzgy0920, 04-20-2024, 06:09 PM
    2 responses
    27 views
    0 likes
    Last Post wzgy0920  
    Started by wzgy0920, 02-22-2024, 01:11 AM
    5 responses
    32 views
    0 likes
    Last Post wzgy0920  
    Working...
    X