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 CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      53 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      34 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      100 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      180 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      170 views
      0 likes
      Last Post CarlTrading  
      Working...
      X