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

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Secondary Series in strategy via Market Replay

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

    Secondary Series in strategy via Market Replay

    does anyone have a sample of code where their strategy looks at a secondary data series such as VIX futures and use that as a condition? For exmaple, trade only if VIX is above 20.

    Also, can this be run via Market Replay where the expiraiton of the contract you are trading (such as ES, for example) is different via a monthly expiration contract such as VIX? How would both data be loaded and replayed to match expiration to expiration?

    #2
    Hello Boonfly8,

    Thank you for your post.

    I am unaware of a VIX specific sample but there are quite a few multi-timeframe samples and information available. One that comes with the platform is the strategy SampleMultiInstrument. In that script, the second series is used with the ADX to form a condition. You can also find more on this subject here: https://ninjatrader.com/support/help...lightsub=multi

    In regard to the second question, when adding a series you do have to add a specific instrument name, which with futures includes the contract. If you are using merge back adjusted you could use the current contract to access past contracts data by supplying a large enough lookback period. If you are not or you are specifically using two separate contracts, you would likely need to use a Print, to see how the OnBarUpdate is called for each series. Because there is a difference in the dates between the data, they would not process at the same time or how you would otherwise see most other series process. You would get some data from one BarsInProgress, then a mix of both series BarsInprogress, then just the current contract. A print like the following can help with this question:

    Code:
    protected override void OnBarUpdate()
    {
           Print(BarsInProgress + " " + CurrentBar);
    }

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by mohdhm, Today, 04:37 PM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by trader14, Yesterday, 08:23 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by bigsurftrader, 02-24-2017, 12:23 AM
    4 responses
    1,162 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by svadukia, Yesterday, 01:56 AM
    2 responses
    25 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by quantrob, Today, 10:24 AM
    1 response
    7 views
    0 likes
    Last Post bltdavid  
    Working...
    X