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
No announcement yet.
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.
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
62 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
134 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
75 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
50 views
0 likes
|
Last Post
|

Comment