Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Is an Array of Series possible?

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

    Is an Array of Series possible?

    I use series in my indicator defined as below:

    private Series<double> myDoubleSeries;

    However I need to create 30 different series. Is it possible to create an array of Series?

    basically would become a 2 dimensional array.

    #2
    Hello afshinmoshrefi, and thank you for your question. While this is definitely possible in C#, you will need to be careful to ensure that every single series is instantiated. The easiest way to do this is to set it up in a loop, like so :

    Code:
    private List<Series<double>> myArrayOfDoubleSeries = new List<Series<double>>();
    for (int i = 0; i < 30; i++)
    {
        myArrayOfDoubleSeries.Add(new Series<double>(this));
    }
    Please let us know if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      This worked. Thanks. How can I expose this List of Series to be accessible from another indicator?

      Comment


        #4
        If we change private to public in the above code sample we should be all set.

        Code:
        [FONT=Courier New]public List<Series<double>> myArrayOfDoubleSeries = new List<Series<double>>();
        for (int i = 0; i < 30; i++)
        {
            myArrayOfDoubleSeries.Add(new Series<double>(this));
        }[/FONT]
        It is probably easiest to call every member in a foreach loop from your outer indicator or strategy, that is,

        Code:
        [FONT=Courier New]int i = 0;
        foreach(Series<double> example in myIndicator.myArrayOfDoubleSeries)
        {
            Print("the 0th value of series " + i++ + " is " + example[0]);
        }[/FONT]
        If you just need one series in particular, you can do this :

        Code:
        [FONT=Courier New]Print("The 0th value of series 2 is" + myIndicator.myArrayOfDoubleSeries[2][0]);[/FONT]
        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          array of dataseries in NT7



          NT8 would be similar, with appropriate syntax updates.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          566 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          330 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          547 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          548 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X