OPEN-SOURCE SCRIPT
STRX - Balance Range

STRX - Balance Range is a price-structure indicator designed to identify and track balanced trading ranges directly on the chart.
It detects periods of compression by comparing the recent price box width to ATR-based volatility, then validates the structure using persistence, edge interaction, and price position inside the range.
The script draws historical range boxes, can optionally connect consecutive ranges, and includes a compact statistics table showing the last closed range, the average of the last 10 ranges, and the average of the last 100 ranges.
This makes it useful for traders who want to study how current balance conditions compare with recent and broader market structure.
How it works:
A reference range is built from the highest high and lowest low of the previous lookback window.
The range is accepted only when its width remains compressed relative to ATR and the current price continues to behave inside that structure.
Additional filters help reduce random consolidations by requiring repeated interaction with the range boundaries and a minimum confirmation period.
How to use it:
Use the boxes to locate areas where price is rotating in balance rather than expanding directionally.
Compare the latest closed range with the 10-range and 100-range averages to judge whether current balance conditions are relatively small, typical, or expanded.
The tool is designed for structure reading and contextual analysis, not as a standalone buy/sell signal generator.
Inputs overview:
Range Length controls how many bars are used to define the reference box.
ATR Length and ATR Multiplier control how strict the volatility compression filter is.
Center Distance, Edge Touches, and Confirmation Bars refine the quality of detected ranges.
Visual options allow you to show or hide historical boxes, range markers, connection lines, and the statistics table.
Notes:
The statistics table uses closed historical ranges, so the values remain stable and easier to compare.
This indicator is intended for standard chart types and discretionary structure analysis.
It does not guarantee future performance and should be used together with your own risk management and market context reading.
It detects periods of compression by comparing the recent price box width to ATR-based volatility, then validates the structure using persistence, edge interaction, and price position inside the range.
The script draws historical range boxes, can optionally connect consecutive ranges, and includes a compact statistics table showing the last closed range, the average of the last 10 ranges, and the average of the last 100 ranges.
This makes it useful for traders who want to study how current balance conditions compare with recent and broader market structure.
How it works:
A reference range is built from the highest high and lowest low of the previous lookback window.
The range is accepted only when its width remains compressed relative to ATR and the current price continues to behave inside that structure.
Additional filters help reduce random consolidations by requiring repeated interaction with the range boundaries and a minimum confirmation period.
How to use it:
Use the boxes to locate areas where price is rotating in balance rather than expanding directionally.
Compare the latest closed range with the 10-range and 100-range averages to judge whether current balance conditions are relatively small, typical, or expanded.
The tool is designed for structure reading and contextual analysis, not as a standalone buy/sell signal generator.
Inputs overview:
Range Length controls how many bars are used to define the reference box.
ATR Length and ATR Multiplier control how strict the volatility compression filter is.
Center Distance, Edge Touches, and Confirmation Bars refine the quality of detected ranges.
Visual options allow you to show or hide historical boxes, range markers, connection lines, and the statistics table.
Notes:
The statistics table uses closed historical ranges, so the values remain stable and easier to compare.
This indicator is intended for standard chart types and discretionary structure analysis.
It does not guarantee future performance and should be used together with your own risk management and market context reading.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.