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 Hwop38, 05-04-2026, 07:02 PM
|
0 responses
150 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
303 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
243 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
345 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
174 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|

Comment