Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Getting bar# when using MAX() & MIN()

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

    Getting bar# when using MAX() & MIN()

    Hello,
    I am trying to create a swing indicator based on certain periods that I've created. I've used the MAX() and MIN() to determine the highs and lows of these periods. Does anyone know how to then find the specific bar number for those highs and lows?
    Code:
    if (down period) 
    {
         endBarsAgo1 = CurrentBar;
         startBarsAgo = CurrentBar;
         lowest_Low = MIN(Low, endBarsAgo1 - startBarsAgo1 )[1];
    }
    if(up period)
    {
         startBarsAgo1 = CurrentBar;
         endBarsAgo = CurrentBar;
          highest_High = MAX(High, endBarsAgo - startBarsAgo)[1];
    }
    The MAX() and MIN(), of course, are good for finding the highs and lows for a specific period, but do not give the bar number.

    #2
    Hello CaptainAmericaXX,

    Thanks for your post.

    To find the Highest or Lowest bar in a defined period, you can use the following methods:





    You may want to use these methods to find the Highest and Lowest bars first then the High and low value of those bars.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    161 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    310 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    245 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    350 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    179 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Working...
    X