Support Board
Date/Time: Fri, 29 Nov 2024 08:34:47 +0000
How to Draw a Horizontal Line at High and Low of the Previous 3 Bars
View Count: 793
[2023-02-21 18:52:36] |
User120942 - Posts: 71 |
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: 36350 |
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: 71 |
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. |
To post a message in this thread, you need to log in with your Sierra Chart account: