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

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 Davidtowleii, Today, 12:15 AM
    0 responses
    3 views
    0 likes
    Last Post Davidtowleii  
    Started by guillembm, Yesterday, 11:25 AM
    2 responses
    9 views
    0 likes
    Last Post guillembm  
    Started by junkone, 04-21-2024, 07:17 AM
    9 responses
    68 views
    0 likes
    Last Post jeronymite  
    Started by trilliantrader, 04-18-2024, 08:16 AM
    4 responses
    20 views
    0 likes
    Last Post trilliantrader  
    Started by mgco4you, Yesterday, 09:46 PM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Working...
    X