Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

finding the position of a double in an array

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

    finding the position of a double in an array

    Is there a way to compare and check where Close[0] is in an array or list of numbers?

    So if I have a list of pivots it would compair Close[0] with the pivots and find which pivot is below it and which is above.

    I have a script doing this at the moment with if statements but its not very efficient and very long so I would like to write a method to do the same thing.

    Thanks in advance for any pointers.

    #2
    Hello GKonheiser,

    Thank you for your post.

    You would need to use the Array.Find method to accomplish this.
    http://www.dotnetperls.com/array-find

    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by GKonheiser View Post
      Is there a way to compare and check where Close[0] is in an array or list of numbers?

      So if I have a list of pivots it would compair Close[0] with the pivots and find which pivot is below it and which is above.

      I have a script doing this at the moment with if statements but its not very efficient and very long so I would like to write a method to do the same thing.

      Thanks in advance for any pointers.
      Use a foreach loop. Given how you posted the question, you may want to use a Sorted Dictionary, albeit an ArrayList or generic List would probably be OK too.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      627 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