Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Highest value bars ago < highest value bars ago

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

    Highest value bars ago < highest value bars ago

    Hi,

    I'm trying to code the following:

    Highest High value 10 bars ago is less than highest high value 30 bars ago

    (MAX(High, 10)[1] < MAX(High, 30)[11])

    The above code sounds logical to me but it doesn't work?

    #2
    Hello,

    Thank you for the question.

    Can I ask are you getting an error if you open Tools -> Output window when you run this code?

    I have tested the following and it works with no error,

    Code:
    if (CurrentBar < 11) return;
    if (MAX(High, 10)[1] < MAX(High, 30)[11])
    {
         Print("Do Something");
    }
    I did add the current bar check to prevent index errors, If you do not have this check in your script currently you would need to add it. essentially if you have not checked if the current bar is past 11, on bar 0 it will be looking for bar -11 which will never exist.

    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

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