Thanks!!
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Multiple DataSeries Issue
Collapse
X
-
Multiple DataSeries Issue
HI, can you tell me why this indicator doesn't process the other dataseries when OnBarUpdate is called? It does when it initially gets loaded.
Thanks!!Tags: None
-
You have five data series => the root plus 4 added series.
You have no logic to segregate processing of each series. So as a first step in debugging you should
process each separately.
Here is a snippet from the help file on how to do that.
protected override void OnStateChange()
{
if (State == State.Configure)
{
// Add a 5 minute Bars object: BarsInProgress index = 1
AddDataSeries(BarsPeriodType.Minute, 5);
}
}
protected override void OnBarUpdate()
{
// Check which Bars object is calling the OnBarUpdate() method
if (BarsInProgress == 0)
{
// A value of zero represents the primary Bars which is the ES 09-14
// 1 minute chart.
// Do something within the context of the 1 minute Bars here
}
else if (BarsInProgress == 1)
{
// A value of 1 represents the secondary 5 minute bars added in the Initialize()
// Do something within the context of the 5 minute Bars
}
}
-
Thanks for the reply. I don't have any segregated logic because I want it to perform the same steps for each dataseries. If I add this logic it would be just a lot of duplicated code. Is that thought process wrong?
I tested it and that didn't work. Additionally, this code works fine in a strategy
Thanks!!Last edited by RiversideDude; 04-29-2017, 10:32 AM.
Comment
-
Hello,
Thanks for the post.
Could you provide the output you are getting for the indicator currently?
Additionally, have you removed the indicator from the chart and re-added it after adding the AddDataSeries syntax? In some cases, the series may not have loaded if the instance was not replaced.
Finally, are you able to pull up the secondary instruments with the settings you had used in the script in a chart to see the data?
I look forward to being of further assistance.
Comment
-
Attached is the output that I get when the indicator is initially enabled and after I start the market playback.I did remove and re-add the indicator. Not sure I understand your last question.
Thanks!!Last edited by RiversideDude; 04-29-2017, 10:02 PM.
Comment
-
Good news, it works when the market is "Live". I was testing it during playback, I bet I didn't have the data for the other dataseries downloaded.
Thanks for the help!!
Comment
-
I'm trying to add a variable to count the number of dataseries processed but I can't figure out were to initialize it.
For example: This indicator has 7 dataseries. I want to know once the 7th dataseries has been processed.
Thanks!!Attached Files
Comment
-
-
It didn't work quite as expected since DataLoaded is called only once after all data series have been loaded. What about every time a new bar closes?
Comment
-
-
I did. I also tried State==State.DataLoaded in OnBarUpdate and no luck, it doesn't trigger. It only triggers for the initial load, but not for any bar closes that happens after that.
Thanks!!
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
558 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
324 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
546 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment