Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multidimensional Series<T>

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

    Multidimensional Series<T>

    Hello!
    I am wondering if there is possible to use multidimensional Series<T> in NinjaTrader since I am struggling to fix a problem relate to this two dimentional Series<T>.

    I have the following code:

    HTML Code:
    #region Variables
    private List<Series<double>> myArray
    #endregion 
    else if (State == State.DataLoaded)
    { myArray = new List<Series<double>>(); }
    protected override void OnBarUpdate()
    {
        for (int i = 10; i > 0; i--)
       {
          int val = 0;
          myArray.Add(new Series<double>(this));
         for (int j = 10; j > 0; j--)
         {
             myArray[i][val] = Close[j];
             val++;
          }
      }
    }
    The print() fucntion pops up a message the I am trying to acces a value out of range.

    At this level, I do not know if the declaration and the instanciation are correct or if the sections to do that are correct.

    I would appreciate any help.

    Many thanks in advance.

    #2
    Hello Stanfillirenfro,

    You can create a list of series like you are however if you want to loop over it you would have to make sure the elements are at those indexes.

    A list wont start with 10 elements so I am not sure how to advise on the loop you are using. I would suggest starting more simply without loops so you can better understand how the indexing works.

    Code:
    myArray.Add(new Series<double>(this));
    myArray[0][0] = Close[0];
    Keep in mind that creating series in OnBarUpdate wont work, you need to still follow the help guide example for how series need to be created and the states where its created. You would have to ahead of time know how many series you need and then create your list in State.DataLoaded.





    Comment


      #3
      Many thanks Jesse for your reply.
      Thanks for your help. I am dealing with the topic following your advices.
      I will revert to you in case I have problem.

      Thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      621 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      359 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      562 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      567 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X