Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 20:46:13 +0000



How to color a bar if it's size (H-L) is bigger than any of the previous 5 bars?

View Count: 224

[2023-07-10 04:15:30]
shire - Posts: 6
Currently using the "Color Bar based on Alert Condition" study and I'm not sure what formula to use to get it to color a bar a different color if it has a greater height than any of the previous 5 bars on a 2000 tick chart.
[2023-07-10 14:42:34]
John - SC Support - Posts: 36344
It would be the following formula to test against the previous two bars (we leave it to you to expand it to 5 bars, or however many you want):
= AND((H - L) > (H[-1] - L[-1]), (H - L) > (H[-2] - L[-2]))

The particular items you need to reference are the following:
Study/Chart Alerts And Scanning: OR and AND Functions

Study/Chart Alerts And Scanning: Available Main Price Graph Identifiers/Variables

Study/Chart Alerts And Scanning: Referencing Data Other Than on the Last Bar/Column In the Chart
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing

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

Login

Login Page - Create Account