Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.

          Hi Gomi, I've been working with you indicators and have very much enjoyed your work. I have some modifications that I like but have serious slow downs in fast markets. So I searched for help and found this thread. I tried running the Analyzer but came up with many many errors. Since I'm not a programmer by trade, I was wondering if you could give me some help. I've attached a picture of the indicators on a chart and the code for both. Right now I only have errors on the indicator GomCdHaThree. Even …

          Comment


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

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by FishTrade, Yesterday, 11:11 PM
            3 responses
            10 views
            0 likes
            Last Post FishTrade  
            Started by Graci117, Today, 09:02 PM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by ETFVoyageur, Today, 07:55 PM
            0 responses
            8 views
            0 likes
            Last Post ETFVoyageur  
            Started by janio973, Today, 07:24 PM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by aligator, 01-06-2022, 12:14 PM
            4 responses
            248 views
            0 likes
            Last Post john_44573  
            Working...
            X