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 Harry, 05-02-2018, 01:54 PM
      10 responses
      3,203 views
      0 likes
      Last Post tharton3  
      Started by cre8able, Yesterday, 01:16 PM
      3 responses
      11 views
      0 likes
      Last Post cre8able  
      Started by ChartTourist, Today, 08:22 AM
      0 responses
      6 views
      0 likes
      Last Post ChartTourist  
      Started by LiamTwine, Today, 08:10 AM
      0 responses
      2 views
      0 likes
      Last Post LiamTwine  
      Started by Balage0922, Today, 07:38 AM
      0 responses
      5 views
      0 likes
      Last Post Balage0922  
      Working...
      X