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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      157 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      91 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      143 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      131 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      107 views
      0 likes
      Last Post CarlTrading  
      Working...
      X