OPEN-SOURCE SCRIPT
Balanced Price Range (BPR) [TakingProphets]

OVERVIEW
The Balanced Price Range (BPR) study identifies areas where two opposing fair value gaps overlap in price. It marks the shared region between an inverted fair value gap and the newly formed gap that caused the inversion, tracking these zones forward in time until they are invalidated.
PURPOSE AND SCOPE
-----------------------------------------------------------------------------------------------
This study is intended for analytical and educational use. It automates the visual identification of overlapping gap regions so that a chart reader does not need to manually measure where two opposing fair value gaps intersect.
The study does not generate trade signals, recommendations, or forecasts. All markings are analytical references only.
LOGIC STRUCTURE
-----------------------------------------------------------------------------------------------
The study first identifies standard fair value gaps.
When an existing fair value gap is inverted by a confirmed candle close through it, the study checks whether the move responsible for that inversion also formed a new fair value gap in the opposing direction.
If it did, the study calculates the overlapping price region shared by the original gap and the newly formed opposing gap. That shared region is the Balanced Price Range.
If the two gaps do not share any overlapping price, no zone is drawn.
A bullish gap inverted downward by a bearish gap produces a bearish Balanced Price Range. A bearish gap inverted upward by a bullish gap produces a bullish Balanced Price Range.
A zone is invalidated when price closes back through it against its direction. A bearish zone is invalidated on a confirmed close above the zone high. A bullish zone is invalidated on a confirmed close below the zone low. Invalidated zones are removed from the chart and are not restored.
All state transitions require a confirmed bar close. Wicks and intrabar movement do not trigger detection or invalidation.
COMPONENTS AND VISUALS
-----------------------------------------------------------------------------------------------
Balanced Price Range zones are drawn as boxes spanning the overlapping price region and extended forward in time.
Bullish and bearish zones are styled independently.
An optional gradient renders each zone in graded bands at the zero, twenty five, fifty, seventy five, and one hundred percent levels of the zone, each with independent color, style, and thickness settings.
Optional labels identify each zone as a Balanced Price Range, positioned outside the lower right of the zone, with selectable label sizes.
INPUT CATEGORIES
-----------------------------------------------------------------------------------------------
General settings control detection sensitivity, minimum zone sizing, and how many zones are displayed on the chart.
Style settings control zone colors, gradient bands, label visibility, and label sizing for bullish and bearish zones independently.
USAGE GUIDELINES
-----------------------------------------------------------------------------------------------
This study is intended as a contextual reference for observing how price interacts with regions where opposing gaps overlap.
Zones may be used as study markers for observation and journaling. They are not entries, exits, or targets.
The study is designed for use alongside a reader's own analysis rather than in isolation.
OPERATIONAL NOTES AND LIMITATIONS
-----------------------------------------------------------------------------------------------
Because the overlapping region is by definition smaller than either source gap, zones can be narrow on lower timeframes. The minimum sizing filter is provided to manage this.
Detection depends on confirmed closes, so zones appear only after the relevant candle has closed.
Historical and real time behavior may differ in appearance as bars confirm.
Past chart behavior does not indicate future behavior. This study describes structure that has already formed.
ORIGINALITY AND ATTRIBUTION
-----------------------------------------------------------------------------------------------
This implementation is original code. The underlying concepts of fair value gaps, gap inversion, and balanced price ranges are widely discussed within the trading education community and are not claimed as proprietary.
TERMS AND DISCLAIMER
-----------------------------------------------------------------------------------------------
This study is provided for educational and analytical purposes only. It does not constitute financial advice, investment advice, or a recommendation to buy or sell any instrument.
Trading involves substantial risk of loss. Any decisions made are the sole responsibility of the user.
The Balanced Price Range (BPR) study identifies areas where two opposing fair value gaps overlap in price. It marks the shared region between an inverted fair value gap and the newly formed gap that caused the inversion, tracking these zones forward in time until they are invalidated.
PURPOSE AND SCOPE
-----------------------------------------------------------------------------------------------
This study is intended for analytical and educational use. It automates the visual identification of overlapping gap regions so that a chart reader does not need to manually measure where two opposing fair value gaps intersect.
The study does not generate trade signals, recommendations, or forecasts. All markings are analytical references only.
LOGIC STRUCTURE
-----------------------------------------------------------------------------------------------
The study first identifies standard fair value gaps.
When an existing fair value gap is inverted by a confirmed candle close through it, the study checks whether the move responsible for that inversion also formed a new fair value gap in the opposing direction.
If it did, the study calculates the overlapping price region shared by the original gap and the newly formed opposing gap. That shared region is the Balanced Price Range.
If the two gaps do not share any overlapping price, no zone is drawn.
A bullish gap inverted downward by a bearish gap produces a bearish Balanced Price Range. A bearish gap inverted upward by a bullish gap produces a bullish Balanced Price Range.
A zone is invalidated when price closes back through it against its direction. A bearish zone is invalidated on a confirmed close above the zone high. A bullish zone is invalidated on a confirmed close below the zone low. Invalidated zones are removed from the chart and are not restored.
All state transitions require a confirmed bar close. Wicks and intrabar movement do not trigger detection or invalidation.
COMPONENTS AND VISUALS
-----------------------------------------------------------------------------------------------
Balanced Price Range zones are drawn as boxes spanning the overlapping price region and extended forward in time.
Bullish and bearish zones are styled independently.
An optional gradient renders each zone in graded bands at the zero, twenty five, fifty, seventy five, and one hundred percent levels of the zone, each with independent color, style, and thickness settings.
Optional labels identify each zone as a Balanced Price Range, positioned outside the lower right of the zone, with selectable label sizes.
INPUT CATEGORIES
-----------------------------------------------------------------------------------------------
General settings control detection sensitivity, minimum zone sizing, and how many zones are displayed on the chart.
Style settings control zone colors, gradient bands, label visibility, and label sizing for bullish and bearish zones independently.
USAGE GUIDELINES
-----------------------------------------------------------------------------------------------
This study is intended as a contextual reference for observing how price interacts with regions where opposing gaps overlap.
Zones may be used as study markers for observation and journaling. They are not entries, exits, or targets.
The study is designed for use alongside a reader's own analysis rather than in isolation.
OPERATIONAL NOTES AND LIMITATIONS
-----------------------------------------------------------------------------------------------
Because the overlapping region is by definition smaller than either source gap, zones can be narrow on lower timeframes. The minimum sizing filter is provided to manage this.
Detection depends on confirmed closes, so zones appear only after the relevant candle has closed.
Historical and real time behavior may differ in appearance as bars confirm.
Past chart behavior does not indicate future behavior. This study describes structure that has already formed.
ORIGINALITY AND ATTRIBUTION
-----------------------------------------------------------------------------------------------
This implementation is original code. The underlying concepts of fair value gaps, gap inversion, and balanced price ranges are widely discussed within the trading education community and are not claimed as proprietary.
TERMS AND DISCLAIMER
-----------------------------------------------------------------------------------------------
This study is provided for educational and analytical purposes only. It does not constitute financial advice, investment advice, or a recommendation to buy or sell any instrument.
Trading involves substantial risk of loss. Any decisions made are the sole responsibility of the user.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。