OPEN-SOURCE SCRIPT
Hardwaybets' Protected Highs / Protected Lows Trading

Protected Highs & Lows – Multi-Condition Structural Marker
This indicator identifies specific candle formations where price breaks a previous candle’s high or low, fails to maintain that break, and confirms the rejection with an additional condition involving prior candles. These marked locations offer a visual reference for areas where price attempted directional expansion but did not sustain it. All levels remain visible until later invalidated by price movement.
Protected High – Detection Logic
A Protected High is marked only when all three of the following conditions occur:
1. Break of Previous High
The current candle trades above the prior candle’s high.
2. Close Back Inside Range
The current candle closes within the high-to-low range of the previous candle, indicating the upward expansion was not sustained.
3. Reversal Through Prior Bullish Structure
After forming the high, price closes below the opening price of one or more bullish candles that were part of the upward movement into that high.
This reflects a shift away from the prior upward structure.
When all three conditions are met, the high of the candle that created the event is marked on the chart.
Protected Low – Detection Logic
A Protected Low is marked only when all three of the following conditions occur:
1. Break of Previous Low
The current candle trades below the prior candle’s low.
2. Close Back Inside Range
The current candle closes within the high-to-low range of the previous candle, indicating the downward expansion was not sustained.
3. Reversal Through Prior Bearish Structure
After forming the low, price closes above the opening price of one or more bearish candles that were part of the downward movement into that low.
This reflects a shift away from the prior downward structure.
When all three conditions are met, the low of the candle that created the event is marked on the chart.
Level Management
* Marked highs and lows remain active as long as price does not trade beyond them.
* If price moves past a marked level, that level is removed.
* Only active, unviolated structural reference points remain displayed.
Market Structure Context (Strictly Non-Signaling)
Protected highs and lows can help traders observe areas where:
* Price briefly exceeded a previous high or low
* That expansion was not maintained
* Price then moved back through recent candles associated with the prior direction
These observations can be used by traders to understand how price interacts with nearby structural reference points.
The indicator itself does not provide trade entries, exits, or directional guidance.
Customization Options
The indicator provides adjustable settings for:
* Marker style (labels or shapes)
* Shape type (circle, square, diamond, etc.)
* Colors for highs and lows
* Vertical spacing between markers and candles
These options help maintain clarity on different chart types and timeframes.
Intended Use
The indicator does not generate forecasts or trading signals.
Its purpose is to visually highlight multi-condition candle formations where price briefly exceeded a prior high or low, failed to sustain that expansion, and later reversed through nearby structural points.
Compatibility
Suitable for all assets and timeframes.
This indicator identifies specific candle formations where price breaks a previous candle’s high or low, fails to maintain that break, and confirms the rejection with an additional condition involving prior candles. These marked locations offer a visual reference for areas where price attempted directional expansion but did not sustain it. All levels remain visible until later invalidated by price movement.
Protected High – Detection Logic
A Protected High is marked only when all three of the following conditions occur:
1. Break of Previous High
The current candle trades above the prior candle’s high.
2. Close Back Inside Range
The current candle closes within the high-to-low range of the previous candle, indicating the upward expansion was not sustained.
3. Reversal Through Prior Bullish Structure
After forming the high, price closes below the opening price of one or more bullish candles that were part of the upward movement into that high.
This reflects a shift away from the prior upward structure.
When all three conditions are met, the high of the candle that created the event is marked on the chart.
Protected Low – Detection Logic
A Protected Low is marked only when all three of the following conditions occur:
1. Break of Previous Low
The current candle trades below the prior candle’s low.
2. Close Back Inside Range
The current candle closes within the high-to-low range of the previous candle, indicating the downward expansion was not sustained.
3. Reversal Through Prior Bearish Structure
After forming the low, price closes above the opening price of one or more bearish candles that were part of the downward movement into that low.
This reflects a shift away from the prior downward structure.
When all three conditions are met, the low of the candle that created the event is marked on the chart.
Level Management
* Marked highs and lows remain active as long as price does not trade beyond them.
* If price moves past a marked level, that level is removed.
* Only active, unviolated structural reference points remain displayed.
Market Structure Context (Strictly Non-Signaling)
Protected highs and lows can help traders observe areas where:
* Price briefly exceeded a previous high or low
* That expansion was not maintained
* Price then moved back through recent candles associated with the prior direction
These observations can be used by traders to understand how price interacts with nearby structural reference points.
The indicator itself does not provide trade entries, exits, or directional guidance.
Customization Options
The indicator provides adjustable settings for:
* Marker style (labels or shapes)
* Shape type (circle, square, diamond, etc.)
* Colors for highs and lows
* Vertical spacing between markers and candles
These options help maintain clarity on different chart types and timeframes.
Intended Use
The indicator does not generate forecasts or trading signals.
Its purpose is to visually highlight multi-condition candle formations where price briefly exceeded a prior high or low, failed to sustain that expansion, and later reversed through nearby structural points.
Compatibility
Suitable for all assets and timeframes.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。