Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Sort a SortedList by Value

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

    #16
    Thank you Zachary,
    I now have my Userdefined Method working and am using it to swap keys and values. That part works but I'm having problems accessing those Keys and Values.

    In the attachment, I'm trying to print the Keys by indexing but getting a compile error saying I can't apply indexing. I don't understand ...Can you help?

    regards,
    taddypole...
    Attached Files

    Comment


      #17
      Hello Taddypole,

      You cannot utilize brackets to apply indexing

      You will need to utilize the ElementAt() method to access a specific index.

      Please take a look at this MSDN page for more information about this method: https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx
      Zachary G.NinjaTrader Customer Service

      Comment


        #18
        Thank you Zachary,

        The ElementAt() is fine and I can print out the Values and Keys but what I'm interested in is the Key. That is my Pivot of interest and I want to draw a trendline based on that key.

        How do I access the key of that highPvtSLopesDictInverted and use it to locate the appropriate rise and run values in my highPvtPriceList to draw the trendlines.

        regards,
        taddypole...

        Comment


          #19
          Taddypole,

          I recommend reviewing the documentation from MSDN on collections and keys: https://msdn.microsoft.com/en-us/lib..._KeyValuePairs

          Comment


            #20
            Thanks Patrick,

            I have been reading... (a lot!) and finally have completed my indicator. Happy with the results.

            regards,
            taddypole...
            Attached Files

            Comment


              #21
              I'm now looking at an enhancement to my SteepestSlope indicator. I want to get the "StartBar" value in:

              Draw.NinjaTrader.Gui.Chart.ChartLine.Base" object: Is it possible to retrieve this property to find a match?

              Refer to the attached picture.

              regards,
              taddypole...
              Attached Files

              Comment


                #22
                You could use CurrentBar - StartBarsAgo: http://ninjatrader.com/support/helpGuides/nt7/iline.htm

                Comment


                  #23
                  Thank you Patrick,

                  That does work and gives me the StartBar.

                  I then created a Foreach Loop to verify my IDot collection. What is strange is that it only prints the last IDot object instance. I put a loop counter to verify it is incrementing but still only get the last IDot object.

                  Do you know what might be going on?

                  regards,
                  taddypole...
                  Attached Files

                  Comment


                    #24
                    Hello Taddypole,

                    Thanks for your post.

                    Does the same thing occur if you change the dot tag name to be just "MyDotLow-"+CurrentBar? I suspect the expression of +(CurrentBar - recentLowestLowBarsAgo) may not be creating a unique tab name for the dot.

                    Comment


                      #25
                      Thank you Paul,

                      I tried as you suggested but no luck. On the first loop in the 'foreach' routine, it prints the last Low Pivot and then continually repeats printing just the last low pivot.

                      In the printout attached you can see the last loopCount is 125 but it is the same as the first loopCount (not shown). It just doesn't appear to be looping through my dot objects.

                      strange....

                      regards,
                      taddypole...
                      Attached Files

                      Comment


                        #26
                        Taddypole,

                        This is due to their only being one IDot dot object. the IDot object does not hold multiple instances. You would have to created multiple instances, such as dot1 and dot 2.

                        Comment


                          #27
                          Thank you Patrick,

                          Going back and re-reading the documentation, I now understand what IDrawObject is and what information is available.

                          regards,
                          taddypole...

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                          0 responses
                          577 views
                          0 likes
                          Last Post Geovanny Suaza  
                          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                          0 responses
                          334 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by Mindset, 02-09-2026, 11:44 AM
                          0 responses
                          101 views
                          0 likes
                          Last Post Mindset
                          by Mindset
                           
                          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                          0 responses
                          553 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by RFrosty, 01-28-2026, 06:49 PM
                          0 responses
                          551 views
                          1 like
                          Last Post RFrosty
                          by RFrosty
                           
                          Working...
                          X