Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple Data Series

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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:
    else if (State == State.Configure)
    {
        // Checkbox from properties
        if (fiveMinuteEnabled)
        {
            AddDataSeries(BarsPeriodType.Minute, 5);
        }
        else if (fifteenMinuteEnabled)
        {
            AddDataSeries(BarsPeriodType.Minute, 15);
        }
        
    }​

    #2
    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

    Comment


      #3
      Great thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      44 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      56 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      35 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      95 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      57 views
      0 likes
      Last Post PaulMohn  
      Working...
      X