Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Out of the last x bars mark bars with the same high/low

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

    Out of the last x bars mark bars with the same high/low

    I was unable to find an existing indicator for the above.

    Look back period = x

    examples based on a look back period of 10

    mark the high of the bars that had the same high in the last 10 bars

    mark the low of the bars that had the same high in the last 10 bars

    ideally

    if 4 of the highs during the look back period had the same high then mark each of those bars with the number 4.

    if 4 of the lows during the look back period had the same low then mark each of those bars with the number 4

    if 3 of the highs during the look back period had the same high then mark each of those bars with the number 3

    and so on.

    minimum number with same h/l would be 2.

    #2
    Hello skiguy,

    Thank you for your post.

    I am unaware of such an indicator. Are you looking for custom development or do you wish to develop this yourself?

    Comment


      #3
      So far I have been able to either find everything I needed or written the code myself. In some cases I have made my own versions of complex stuff and worked out what to change.

      I am open to custom development also.

      Just thought it would be a pretty easy thing to code for an experienced NT dev.

      Especially if it was just to mark the bar highs and lows with a dot e.g. not do the numbering.

      Comment


        #4
        I can code it the long hand way i.e. using basic code that has no look back period etc just hard coded e.g.
        if (High[0] == High[1] or ..............) etc

        Comment


          #5
          DrawText("tag01"+CurrentBar, true, "l", 0, High[0], 0, Color.Black, new Font("Wingdings", 10), StringAlignment.Center, Color.Black, Color.Black, 0);

          but that won't really give me what I want as it wld only put the dot on High[0] which may not have the been one of the equal highs and nor wld it give me the different equal highs.

          For example bars 3 and 5 may have equals highs and bars 0,2 and 7 may have equal highs but different high to bars 3 and 5.


          Comment


            #6
            Just did a little test of simple code and it does not really give me visually what I want.

            Also doing the coding that way it seems to take a while to execute on a chart. I am not sure if that is because DrawText is slow.

            I think someone more experienced could easily code it and would find it to be very valuable.

            Comment


              #7
              Any takers

              Comment


                #8
                The crude code is not the way to go

                Comment


                  #9
                  I try this,but for somereason it doesn`t draw text

                  if(High[0] == High[1] && High[1] == High[2])
                  DrawLine("high", false, 2, High[0], 0, High[0], Color.Black, DashStyle.Solid, 2);
                  DrawText("txt", "3Bars Highs", 2, 10, Color.Black);

                  Comment


                    #10
                    Originally posted by outsource View Post
                    I try this,but for somereason it doesn`t draw text

                    if(High[0] == High[1] && High[1] == High[2])
                    DrawLine("high", false, 2, High[0], 0, High[0], Color.Black, DashStyle.Solid, 2);
                    DrawText("txt", "3Bars Highs", 2, 10, Color.Black);
                    This will produce an error because at the very first bar (CurrentBar == 0), you refer to the bar that is 1 and 2 bars ago.

                    Please write this at the very first line of OnBarUpdate():

                    if (CurrentBar < 2) return;
                    Cheers.
                    Pi
                    ninZa
                    NinjaTrader Ecosystem Vendor - ninZa.co

                    Comment


                      #11
                      Originally posted by ninZa View Post
                      This will produce an error because at the very first bar (CurrentBar == 0), you refer to the bar that is 1 and 2 bars ago.

                      Please write this at the very first line of OnBarUpdate():



                      Cheers.
                      Pi
                      I`ve already had this -
                      Code:
                      if (CurrentBar < 2) return;
                      statement below OnBarUpdate(), as i was trying to use it within some other indicator.

                      It draws the line,tho.

                      Comment


                        #12
                        You have to wrap the 2 statements in a block, and you have to make the tags unique (the simplest way is to include + CurrentBar in the tags):

                        if(High[0] == High[1] && High[1] == High[2]) {
                        DrawLine("high" + CurrentBar, false, 2, High[0], 0, High[0], Color.Black, DashStyle.Solid, 2);
                        DrawText("txt" + CurrentBar, "3Bars Highs", 2, 10, Color.Black);
                        }
                        Pi
                        ninZa
                        NinjaTrader Ecosystem Vendor - ninZa.co

                        Comment


                          #13
                          Originally posted by ninZa View Post
                          You have to wrap the 2 statements in a block, and you have to make the tags unique (the simplest way is to include + CurrentBar in the tags):



                          Pi
                          Still no text marker...

                          Comment


                            #14
                            You draw 2 things: line + text. Do you see the line?

                            Can you post your code file as well, or at least your full codes of OnBarUpdate()?

                            Thanks.
                            Pi
                            ninZa
                            NinjaTrader Ecosystem Vendor - ninZa.co

                            Comment


                              #15
                              Originally posted by ninZa View Post
                              You draw 2 things: line + text. Do you see the line?

                              Can you post your code file as well, or at least your full codes of OnBarUpdate()?

                              Thanks.
                              Pi
                              The line is there.Sorry,cannot post the code as it is propriety.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              566 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              330 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
                              547 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              548 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X