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 manipulation

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

    Array manipulation

    I can use a while loop to move data one direction or another in my (rather large) array.

    But isn't there a more efficient way? Something like "OK array, offset everything down three" that would leave the three at the top clear and truncate the last three.

    I poked arround the MSDN site and the Clear method would work if I could then sort them but the Sort method only works on one dimnsional arrays

    #2
    >> But isn't there a more efficient way?
    Not that I know of.

    Hints:
    a) Rather than moving items you might consider adjustingyour access index by 3. No need to physically move items.
    b) If you really want to get rid of the "oldest" items then you might consider looking for an alternate collection like e.g. queue (see MSDN docs).

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Kaledus, Today, 01:29 PM
    0 responses
    3 views
    0 likes
    Last Post Kaledus
    by Kaledus
     
    Started by PaulMohn, Today, 12:36 PM
    1 response
    16 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by yertle, Yesterday, 08:38 AM
    8 responses
    37 views
    0 likes
    Last Post ryjoga
    by ryjoga
     
    Started by rdtdale, Today, 01:02 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by alifarahani, Today, 09:40 AM
    3 responses
    19 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X