Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Multi-timeframe/instrument problem
Collapse
X
-
Hi Josh, Thanks for your reply, but the code is a strategy, not an indicator, I just want to add more timeframes than the primary timeframe and the tick timeframe that's required.Originally posted by NinjaTrader_Josh View PostMulti-time frame indicators are not supported in NT6.5. They will be in NT7.
Comment
-
kw123, it looks like you're heading in the right direction. What errors did you run into?
To create a multi-instrument strategy you need to add the instrument (we'll use ES 03-10 in this example) in the Initialize() section:
Then, you can just reference the additional instrument through Closes[1][n] like you already are in the code you posted.Code:protected override void Initialize() { Add("ES 03-10", PeriodType.Volume, 1000); }
If you'd like, there is also a multi-instrument that comes pre-loaded with a NinjaTrader installation that you could take a look at from Tools -> Edit NinjaScript -> Strategy -> SampleMultiInstrument.AustinNinjaTrader Customer Service
Comment
-
Hi Austin, thanks for your reply.
I've looked at the pre-loaded sample multi-timeframe/multi-instrument strategies, and tried to use them without any success.
For example, if I use 5000 volume chart as my primary timeframe, add another 1000 volume as my secondary timeframe(which will be referred as BarsArray[2],because there a required tick timeframe) and change the following part in the code that refer to the primary to secondary:
From
toPHP Code:else if ((base.BarsInProgress == 0) && (base.CurrentBar > this.LastCurrentBar))
FromPHP Code:else if ((base.BarsInProgress == 2) && (base.CurrentBar > this.LastCurrentBar))
toPHP Code:if (base.BarsArray[0].CurrentBar >= Math.Max((this.L1 + this.L2) - 1, this.L3))
FromPHP Code:if (base.BarsArray[2].CurrentBar >= Math.Max((this.L1 + this.L2) - 1, this.L3))
toPHP Code:if (BarsInProgress != 0 ) return; if(BarsInProgress==0) { Print(Time[0]+" "+VolumeSeries[0]); }
Then I ran this new strategy, the values I got is different from the values I got if I just ran the original strategy on a 1000 volume chart, which make me very confused.PHP Code:if (BarsInProgress != 2 ) return; if(BarsInProgress==2) { Print(Time[0]+" "+VolumeSeries[0]); }
Comment
-
kw123, you are running the strategy on another instrument/period, so it would make sense that the values don't match.
You can try printing more values than just the time and your current data series (price, volume, open, high, low, etc) to help you verify which data set you're working with and such.AustinNinjaTrader Customer Service
Comment
-
This is a wild hunch, but the problem might be caused due to sequencing of the bar update calls. Since your volume charts are multiples of each other, the tick which cause the larger one to trigger will also cause the smaller one to trigger (or round abouts). The sequence in which the ticks for different bars are called might be causing some problem when you are looking for exact data. Try something which is not a multiple (say 1000, and 2500) and see how the results are.
Comment
-
Originally posted by aviat72 View PostThis is a wild hunch, but the problem might be caused due to sequencing of the bar update calls. Since your volume charts are multiples of each other, the tick which cause the larger one to trigger will also cause the smaller one to trigger (or round abouts). The sequence in which the ticks for different bars are called might be causing some problem when you are looking for exact data. Try something which is not a multiple (say 1000, and 2500) and see how the results are.
Hi aviat72, thanks for your advice, I think too it may be something like that, but my programming knowledge is just too limited to figure it out myself.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
656 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
371 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
109 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
579 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment