Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Pivot Point (Lows) /

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

    Pivot Point (Lows) /

    Hi,

    Pivot Point Lows are determined by the number of bars with higher lows on either side of a Pivot Point Low. I've been able to find pivot point lows when I specify how many lows I require which are greater than the Pivot Point Low.

    I thought I could build on that to identify Pivot Point Lows, ranging from a higher low on each side of a specific low (Level 1) to having 21 higher lows on each side of a Pivot Point Low (Level 21). You can see from the attached chart, it displays multiple Point Point Lows at various levels.

    The code is pasted below:-
    Code:
    if (CurrentBar < 43) return;
    
    
    for (int level = 1; level <= 21; level++)
    {
    for (int x = 1; x >= level; x++)
    {
    if ( Math.Min(Low[level], Close[level+1]) < Math.Min(Low[level - x], Close[level-x+1]) && Math.Min(Low[level], Close[level+1]) < Math.Min(Low[level + x], Close[level+x+1]))
    {
    
    Draw.Text(this, "tag1"+CurrentBar, level.ToString(), level, Math.Min(Low[x],Close[x+1]), Brushes.Red);
    }
    }
    }
    Could someone please help?

    Regards
    Kay Wai
    Attached Files
    Last edited by kaywai; 04-25-2022, 04:22 AM.

    #2
    Hello kaywai,

    Can you provide more detail on what specifically you are asking for help with?

    You may need to use a Print inside your loops in case that is not working as you had expected.

    Comment


      #3
      Hi Jesse,

      I am not getting the desired result at all and it's been printing 21 at every bar. The inner for loop when fine when the integer "level" was at a single level, ie there was no outer loop. I would like some pointers on how to proceed to get the desired result as per the attached chart above.

      Regards
      Kay Wai

      Comment


        #4
        Hello kaywai,

        If the result in your test was unexpected then you would need to identify what part of your code is not working like you wanted.

        I would suggest to remove the outer loop to move back to the point where you described it as working and then determine what specific numeric values you need for the outer loops condition. Based on the pattern of integers you come up with would determine how that outer loop would be formed.

        The loop is going to do the action inside it the number of times you specify, if you are trying to check that there are 21 bars on either side of the pivot then you likely don't need an outer loop but a secondary loop after you found the pivot to do other conditions around that point.

        Comment


          #5
          Hi Jesse,

          21 bars on either side of the pivot is the maximum. There may be pivots where there are 3 bars on either side or 8 bars on either. The minimum no of bars on either side is 1 and the max I would like is 21. I would like the code to point out where all these pivots are because, for example, 21 bar pivot is also a 5 bar pivot or even a 1 bar pivot. So i'd like to find out which pivots have more significance. Hence I think I need an outer loop.

          Regards
          Kay Wai

          Comment


            #6
            Hello kaywai,

            From the added detail I am not certain what part you are asking for help with. I won't be able to create that for you based on the description but I could make suggestions on how you can work toward that. If you feel that the outside loop is the best way to make the condition you want then I would suggest to add a Print inside the outside loop to print out the loop index and also any other values you wanted to check like the pivot prices or if it was true/false.

            The Draw.Text is going to only show the last time you called it so that is not useful for debugging the loop.
            Code:
            Draw.Text(this, "tag1"+CurrentBar, level.ToString(), level, Math.Min(Low[x],Close[x+1]), Brushes.Red);
            The tag is "tag1"+CurrentBar or tag1329424 as an example, that won't change through the loop so you get only 1 text object drawn for your last loop iteration where the condition was true.

            A Print("") inside the loop will output all iterations to the output window so that you can step through the output and better understand what your loop is doing.

            Code:
            for (int level = 1; level <= 21; level++)
            {
            for (int x = 1; x >= level; x++)
            {
            Print(level + " " + x);

            Comment


              #7
              Thanks Jesse. Lemme try that.

              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