Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Array/List vs. DataSeries types

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

    Array/List vs. DataSeries types

    Hello,

    I am developing an indicator that needs to memorise a number of past values of a given variable, and I am uncertain whether to use a DataSeries or an Array and/or List type to store those values.

    Which type is more efficient in terms of processing times and memory usage?

    My belief was that DataSeries were more expensive in terms of resources (particularly when you only need to store a handful of values in a chart of 1000+ bars), but after modifying the code to handle Array/List types and seeing RAM usage shoot up by 40MB or so in each case now I am not so sure.

    Thanks,

    Stopped
    Last edited by Stopped; 11-26-2011, 02:59 AM.

    #2
    Stopped,

    If there is some maximum number of values you need to store, an array would work. I would perhaps recommend a queue if this is the case.

    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by Stopped View Post
      Hello,

      I am developing an indicator that needs to memorise a number of past values of a given variable, and I am uncertain whether to use a DataSeries or an Array and/or List type to store those values.

      Which type is more efficient in terms of processing times and memory usage?

      My belief was that DataSeries were more expensive in terms of resources (particularly when you only need to store a handful of values in a chart of 1000+ bars), but after modifying the code to handle Array/List types and seeing RAM usage shoot up by 40MB or so in each case now I am not so sure.

      Thanks,

      Stopped
      As to the extra resources that seemed to be required, I should think that that would depend on what operations you are performing relative to the ArrayList. For example, is you are using a "for loop" to populate the Arraylist on each run, that uses a surprising amount of resources. I am not saying that that is what you are doing; I am just giving an example of what I thought was a simple construct that I found out was using way more resources because of the way in which I used it.

      You may have to profile the indicator to see what is really taking up the resources.

      Comment


        #4
        Thank you both for your answers. Koganam, if I may ask: I am fairly new at developing indicators and am learning by doing and realising, after the fact, that perhaps I could have coded things a bit more efficiently, if I had known how. So I was quite curious about this profiling exercise that you are suggesting I should use when coding. What exactly does that mean and/or involve? Is there any document you could point me to where I could learn how to do this? Thanks again.

        Comment


          #5
          Originally posted by Stopped View Post
          Thank you both for your answers. Koganam, if I may ask: I am fairly new at developing indicators and am learning by doing and realising, after the fact, that perhaps I could have coded things a bit more efficiently, if I had known how. So I was quite curious about this profiling exercise that you are suggesting I should use when coding. What exactly does that mean and/or involve? Is there any document you could point me to where I could learn how to do this? Thanks again.
          See this link at BMT.

          Comment


            #6
            Excellent, thank you VERY much koganam for sending this link

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            630 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            364 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
            566 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            568 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X