Support Board
Date/Time: Fri, 29 Aug 2025 10:13:32 +0000
How to Draw a Horizontal Line at High and Low of the Previous 3 Bars
View Count: 1554
[2023-02-21 18:52:36] |
User120942 - Posts: 74 |
Hi @Sierra Chart Support and other Sierra Chart Users, I would like to draw a horizontal line designating the Highest High (SG1) and Lowest Low (SG2) of the Previous 3 Bars (Not including the current bar). I have tried using the Highest High and Lowest Low Subgraphs from the "Highest High/Lowest Low Over N Bars" study but it does not permit me to omit the High and Low of the current bar from the calculation. I am trying to draw a Zone designating the High and Low of the previous 3 Bars to better see when price breaks out from that zone. Please let me know if there is another study or Alert Condition Formula that can achieve the desired result. Any assistance is greatly appreciated. Thank You |
[2023-02-21 21:56:10] |
John - SC Support - Posts: 41525 |
You can use the Spreadsheet Formula to do this since it is not too many bars that you are checking. You will enter the following formula to get the highest high of the 3 bars prior to the current bar: =MAX(H[-1], H[-2], H[-3]) If you just want the information for the most recent bars, then you can set the Input for the Spreadsheet Formula for Number of Bars to Calculate to 1. Just be aware that if you do this, you will not be able to see the graph of the result in its own region, as it is just one point. You can put the study in the main region and then set the draw style to something like Square and increase the size to see it on the current bar. Or if you want the value, you can use the Text Display from Study or any other number of ways to view the particular data point. Refer to the following for the Spreadsheet Formula study: Spreadsheet Formula For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2023-02-21 23:38:03] |
User120942 - Posts: 74 |
Much appreciated @John - SC Support, The Spreadsheet Formula study is a gem that I will be using more in the future. I used the formula you provided to calculate the High of the last 3 bar and the results are exactly what I wanted. In case anyone else has the same question. I used 2 separate instances of the Spreadsheet Formula study (1 for the High and 1 for the Low). The Spreadsheet Formula for the High of the last 3 bars (excluding the current bar): =MAX(H[-1], H[-2], H[-3]) The Spreadsheet Formula for the Low of the last 3 bars (excluding the current bar): =MIN(L[-1], L[-2], L[-3]) I set the Number of Bars to Calculate value to 4 to include the current bar and the previous 3 bars. Then I used Draw Style (Line From End of Chart Left to Right) for both instances with different colors for the High and Low. Thanks again for pointing me in the right direction @John - SC Support. |
[2025-02-23 00:14:12] |
User303857 - Posts: 157 |
Thank You
Date Time Of Last Edit: 2025-08-25 07:36:03
|
[2025-02-23 06:03:33] |
Acro - Posts: 449 |
Did you try Line at Last Bar to Edge ?
|
![]() |
[2025-02-23 07:12:03] |
User303857 - Posts: 157 |
Thank You
Date Time Of Last Edit: 2025-08-25 07:38:13
|
[2025-02-23 15:33:06] |
User120942 - Posts: 74 |
Can you post a screen shot of your formula and draw style settings? It has to be one or the other that's causing the issue.
|
[2025-02-23 16:49:41] |
User303857 - Posts: 157 |
Thank You
Date Time Of Last Edit: 2025-08-25 07:36:47
|
Attachment Deleted. Attachment Deleted. |
[2025-02-23 16:53:42] |
User303857 - Posts: 157 |
Thank You
Date Time Of Last Edit: 2025-08-25 07:37:58
|
[2025-02-23 20:38:01] |
User120942 - Posts: 74 |
I reviewed your chartbook. The formula and settings look fine. Maybe you intended to see more historical lines. I updated your previous chartbook with 3 different settings and formulas. See which one suits your purposes best. My original example was similar to Option 3. I only needed to see the Highs and Lows for the most recent bar using horizontal lines from the left edge to the right edge. As such I only needed the last 4 bars. I anticipate that you are wanting to view more historical highs and lows and updated the lookback period to 2000 bars so that you can get historical lines on the chart. See the attached chartbook and examples and verify if any of the options is what you are looking for. Hope this is helpful. Date Time Of Last Edit: 2025-02-24 03:10:27
|
![]() ![]() ![]() |
[2025-02-23 20:38:47] |
User120942 - Posts: 74 |
Here's the revised chartbook for your review.
|
![]() |
[2025-02-24 01:57:42] |
User303857 - Posts: 157 |
Thank You
Date Time Of Last Edit: 2025-08-25 07:37:36
|
To post a message in this thread, you need to log in with your Sierra Chart account: