Expected Behavior on the Chart Upper Zone: When the price crosses or goes above the highest high over the past length bars, the background color will change to the color you set (default is blue, with transparency 80%). Lower Zone: Similarly, when the price drops below the lowest low over the past length bars, the background color will also change. Lines: The upper and lower boundaries (highest high and lowest low) will be marked with horizontal lines in green and red, respectively. Alerts: If the price breaks above or below these zones, the respective alert will trigger. Example Scenario: If you're using this on a 1-hour chart and set the length to 20, the script will look back 20 hourly bars to calculate the highest and lowest prices during that period. If the price breaks above the highest or below the lowest level, the background color will change accordingly, and you'll be alerted if you have set up an alert.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.