Login Page - Create Account

Support Board


Date/Time: Thu, 25 Apr 2024 18:07:20 +0000



[Programming Help] - Code for HIGH > Highest High of last X bars

View Count: 1456

[2018-12-11 01:51:14]
User121729 - Posts: 37
I want to do a color bar condition alert and want to have in the code the bar must have a High that is the Highest high of the last X bars...

What would that code look like?

H>?????


Thanks
[2018-12-11 04:27:10]
Sawtooth - Posts: 3976
Since you can't use a range in Simple Alert syntax, the easiest way to do what you want is to add the Highest High/Lowest Low Over N Bars study, and reference it in the color bar's formula, like this:
=H>ID1.SG1[-1]
where ID1 is the HH/LL Over N Bars study.

Otherwise your formula would look like this:
=AND(H>H[-1],H>H[-2],H>H[-3],H>H[-4],H>H[-5],H>H[-6],H>H[-7],H>H[-8],H>H[-9]) ...etc.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account