else if (State == State.Configure)
{
// Checkbox from properties
if (fiveMinuteEnabled)
{
AddDataSeries(BarsPeriodType.Minute, 5);
}
else if (fifteenMinuteEnabled)
{
AddDataSeries(BarsPeriodType.Minute, 15);
}
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Multiple Data Series
Collapse
X
-
Multiple Data Series
I'm considering adding multiple data series to an indicator, but it seems that dynamically adding values to AddDataSeries is not recommended. Is having some checkboxes when loading the indicator a good approach to allow a user to select if they want enable a certain data series? This will allow a user to select predetermined default additional data series, but not take up memory if they don't want to use a certain data series. At least that's the idea behind it.
Code:Tags: None
-
Hello WaleeTheRobot,
Using a condition to call AddDataSeries() is still dynamic.
Instead of dynamically choosing if a data series is loaded, which can cause errors in some situations (like when optimizing or hosting a symbiote), we would recommend statically hard coding the AddDataSeries() call and then in OnBarUpdate() deciding if you want to use the data.
protected override void OnBarUpdate()
{
if (fifteenMinuteEnabled == false && BarsInProgress == 1)
return;
}
You could also choose to dynamically add a custom new Series<double> and dynamically pump data into from a BarsRequest.
Below is a link to an example.
Chelsea B.NinjaTrader Customer Service
- Likes 1
-
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
545 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