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?
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!
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
NinjaTrader
Secondary Series in strategy via Market Replay
Collapse
X
-
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?Tags: None
-
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
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Padan, Today, 02:02 AM
|
3 responses
11 views
0 likes
|
Last Post Today, 08:54 AM | ||
Started by Tim-c, Today, 08:36 AM
|
1 response
3 views
0 likes
|
Last Post Today, 08:45 AM | ||
Started by goodknight777, Today, 08:43 AM
|
0 responses
2 views
0 likes
|
Last Post Today, 08:43 AM | ||
Started by martini, Yesterday, 04:45 PM
|
3 responses
28 views
0 likes
|
Last Post Today, 08:38 AM | ||
Started by Mestor, Today, 03:15 AM
|
2 responses
10 views
0 likes
|
Last Post
by Mestor
Today, 08:36 AM
|
Comment