OPEN-SOURCE SCRIPT
Cập nhật Range breaking indicator

Description
Bull/Bear Area Ratio (last N candles) helps identify potential end-of-range situations by analyzing the relative strength of bullish vs bearish candles over a rolling window of N bars.
Instead of simply counting up or down candles, this script measures the "area" of each candle — the absolute distance between open and close, optionally weighted by volume.
By summing these areas over the last N bars, it calculates the percentage of bullish and bearish energy within that period.
When both sides become balanced (near 50/50), it often signals range exhaustion or possible trend transition.
How it works
Calculates the bullish and bearish area of each candle (abs(close - open), optionally × volume).
Maintains rolling buffers of the last N bars to compute running totals.
Plots both Bullish % (green) and Bearish % (red).
Highlights possible range-ending zones when the bullish ratio nears 50% ± threshold.
Displays a label showing the current balance.
Includes an alert condition when equilibrium is detected.
Inputs
Number of candles (N) – Rolling window length.
Use volume weighting – Multiplies each candle’s area by its volume.
Balance threshold (%) – Sensitivity for detecting equilibrium (default: 10%).
Best use
Combine with volume or volatility indicators to confirm market compression or expansion.
Use on higher timeframes (H1, H4, D1) to detect early signs of accumulation or distribution.
Works across all asset types: crypto, forex, stocks, indices, etc.
Alerts
An alert is triggered when:
“The range of the last N candles is balanced (possible end of range).”
Bull/Bear Area Ratio (last N candles) helps identify potential end-of-range situations by analyzing the relative strength of bullish vs bearish candles over a rolling window of N bars.
Instead of simply counting up or down candles, this script measures the "area" of each candle — the absolute distance between open and close, optionally weighted by volume.
By summing these areas over the last N bars, it calculates the percentage of bullish and bearish energy within that period.
When both sides become balanced (near 50/50), it often signals range exhaustion or possible trend transition.
How it works
Calculates the bullish and bearish area of each candle (abs(close - open), optionally × volume).
Maintains rolling buffers of the last N bars to compute running totals.
Plots both Bullish % (green) and Bearish % (red).
Highlights possible range-ending zones when the bullish ratio nears 50% ± threshold.
Displays a label showing the current balance.
Includes an alert condition when equilibrium is detected.
Inputs
Number of candles (N) – Rolling window length.
Use volume weighting – Multiplies each candle’s area by its volume.
Balance threshold (%) – Sensitivity for detecting equilibrium (default: 10%).
Best use
Combine with volume or volatility indicators to confirm market compression or expansion.
Use on higher timeframes (H1, H4, D1) to detect early signs of accumulation or distribution.
Works across all asset types: crypto, forex, stocks, indices, etc.
Alerts
An alert is triggered when:
“The range of the last N candles is balanced (possible end of range).”
Phát hành các Ghi chú
DescriptionBull/Bear Area Ratio (last N candles) helps identify potential end-of-range situations by analyzing the relative strength of bullish vs bearish candles over a rolling window of N bars.
Instead of simply counting up or down candles, this script measures the "area" of each candle — the absolute distance between open and close, optionally weighted by volume.
By summing these areas over the last N bars, it calculates the percentage of bullish and bearish energy within that period.
When both sides become balanced (near 50/50), it often signals range exhaustion or possible trend transition.
How it works
Calculates the bullish and bearish area of each candle (abs(close - open), optionally × volume).
Maintains rolling buffers of the last N bars to compute running totals.
Plots both Bullish % (green) and Bearish % (red).
Highlights possible range-ending zones when the bullish ratio nears 50% ± threshold.
Displays a label showing the current balance.
Includes an alert condition when equilibrium is detected.
Inputs
Number of candles (N) – Rolling window length.
Use volume weighting – Multiplies each candle’s area by its volume.
Balance threshold (%) – Sensitivity for detecting equilibrium (default: 10%).
Best use
Combine with volume or volatility indicators to confirm market compression or expansion.
Use on higher timeframes (H1, H4, D1) to detect early signs of accumulation or distribution.
Works across all asset types: crypto, forex, stocks, indices, etc.
Alerts
An alert is triggered when:
“The range of the last N candles is balanced (possible end of range).”
Phát hành các Ghi chú
DescriptionBull/Bear Area Ratio (last N candles) helps identify potential end-of-range situations by analyzing the relative strength of bullish vs bearish candles over a rolling window of N bars.
Instead of simply counting up or down candles, this script measures the "area" of each candle — the absolute distance between open and close, optionally weighted by volume.
By summing these areas over the last N bars, it calculates the percentage of bullish and bearish energy within that period.
When both sides become balanced (near 50/50), it often signals range exhaustion or possible trend transition.
How it works
Calculates the bullish and bearish area of each candle (abs(close - open), optionally × volume).
Maintains rolling buffers of the last N bars to compute running totals.
Plots both Bullish % (green) and Bearish % (red).
Highlights possible range-ending zones when the bullish ratio nears 50% ± threshold.
Displays a label showing the current balance.
Includes an alert condition when equilibrium is detected.
Inputs
Number of candles (N) – Rolling window length.
Use volume weighting – Multiplies each candle’s area by its volume.
Balance threshold (%) – Sensitivity for detecting equilibrium (default: 10%).
Best use
Combine with volume or volatility indicators to confirm market compression or expansion.
Use on higher timeframes (H1, H4, D1) to detect early signs of accumulation or distribution.
Works across all asset types: crypto, forex, stocks, indices, etc.
Alerts
An alert is triggered when:
“The range of the last N candles is balanced (possible end of range).”
Phát hành các Ghi chú
DescriptionBull/Bear Area Ratio (last N candles) helps identify potential end-of-range situations by analyzing the relative strength of bullish vs bearish candles over a rolling window of N bars.
Instead of simply counting up or down candles, this script measures the "area" of each candle — the absolute distance between open and close, optionally weighted by volume.
By summing these areas over the last N bars, it calculates the percentage of bullish and bearish energy within that period.
When both sides become balanced (near 50/50), it often signals range exhaustion or possible trend transition.
How it works
Calculates the bullish and bearish area of each candle (abs(close - open), optionally × volume).
Maintains rolling buffers of the last N bars to compute running totals.
Plots both Bullish % (green) and Bearish % (red).
Highlights possible range-ending zones when the bullish ratio nears 50% ± threshold.
Displays a label showing the current balance.
Includes an alert condition when equilibrium is detected.
Inputs
Number of candles (N) – Rolling window length.
Use volume weighting – Multiplies each candle’s area by its volume.
Balance threshold (%) – Sensitivity for detecting equilibrium (default: 10%).
Best use
Combine with volume or volatility indicators to confirm market compression or expansion.
Use on higher timeframes (H1, H4, D1) to detect early signs of accumulation or distribution.
Works across all asset types: crypto, forex, stocks, indices, etc.
Alerts
An alert is triggered when:
“The range of the last N candles is balanced (possible end of range).”
Mã nguồn mở
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Thông báo miễn trừ trách nhiệm
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.
Mã nguồn mở
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Thông báo miễn trừ trách nhiệm
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.