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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
127 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
73 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
115 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
109 views
1 like
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
88 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment