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

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 traderqz, Yesterday, 09:06 AM
      3 responses
      20 views
      0 likes
      Last Post NinjaTrader_ThomasC  
      Started by f.saeidi, Today, 10:19 AM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by kujista, Today, 06:23 AM
      5 responses
      15 views
      0 likes
      Last Post kujista
      by kujista
       
      Started by traderqz, Today, 12:06 AM
      3 responses
      6 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by RideMe, 04-07-2024, 04:54 PM
      5 responses
      28 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X