OPEN-SOURCE SCRIPT

Range Detector v3

833
range detector v3 is a technical range detection tool designed to identify periods of market consolidation, evaluate their quality, map the internal structure of a range, and detect confirmed breakouts and retests.

the script uses a five-factor confirmation model built around adx, choppiness, bollinger bandwidth, bollinger/keltner compression, and linear regression slope. instead of defining a range from a single condition, it requires multiple factors to agree before a structure can become confirmed.

detection options

adx length
controls the calculation period used for adx.

adx ceiling
defines the maximum adx value accepted as a ranging condition. lower adx generally represents weaker directional movement.

choppiness length
sets the calculation period for the choppiness index.

choppiness floor
defines the minimum choppiness value required for the factor to qualify as a ranging condition.

bb / kc length
controls the calculation length used by the bollinger bands and keltner channel.

bollinger mult
adjusts the width of the bollinger bands.

keltner mult
adjusts the width of the keltner channel.

bandwidth percentile ceiling
measures the current bollinger bandwidth relative to its recent 100-bar range. lower values require stronger volatility compression.

linear regression length
sets the period used to calculate the regression slope.

slope ceiling
defines how flat price must be in atr-per-bar terms for the slope factor to qualify.

confirmation options

factors required
selects how many of the five detection factors must agree. the script can require between two and five factors.

confirmed bars needed
controls how long the required factor confluence must persist.

minimum range length
prevents very short structures from being immediately classified as confirmed ranges.

maximum range length
limits how long an active range can remain open before it is archived.

max historical ranges kept
controls the number of completed historical ranges displayed and retained by the indicator.

breakout and retest options

detect breakouts
enables breakout detection above or below a confirmed range.

a breakout is not based only on price crossing a rail. the script also evaluates candle displacement and relative volume participation.

break displacement
sets the minimum candle body size relative to atr required for breakout confirmation.

break participation
sets the minimum relative volume required for a breakout.

detect retests
enables detection of price returning to a previously broken range boundary.

retest lookback
defines how many bars after a breakout remain eligible for retest detection.

range analytics

quartile lines
displays the internal 25%, 50%, and 75% levels of a confirmed range.

these levels can help visualize where price is trading inside the structure rather than treating the entire range as a single zone.

volume poc of the range
calculates an estimated volume point of control inside the range by distributing bar volume according to price bins.

poc bins
controls the resolution used for the range poc calculation.

premium / discount split
divides the active range around its midpoint to provide a simple visual representation of its upper premium and lower discount areas.

visual options

the script includes institutional cyan, neon wizard, and obsidian gold themes.

extend right controls how far the active range structure extends beyond the current bar.

range labels displays information directly on the active range.

live range readout shows the current price position as a percentage of the confirmed range.

dashboard

the dashboard provides a compact view of the current detection state and underlying conditions.

it displays:

state
range quality
active factors
adx
choppiness
bollinger bandwidth condition
compression state
regression slope
range size
current location inside the range
distance from the upper and lower rails
relative volume participation
range age and rail touches
last breakout
last retest
range history
active detection model

the dashboard position and text size can be adjusted from the indicator settings.

quick start

add the indicator to a chart and begin with the default settings.

when the state is idle, the required range conditions are not currently established.

when the state changes to candidate, the detection factors have started to align, but the structure has not yet completed the required confirmation process.

when confirmed appears, the required factor confluence and minimum structural conditions have been satisfied.

the upper and lower rails define the detected range boundaries. use the quartiles, midpoint, poc, premium/discount zones, and live position readout to evaluate where price is trading inside that structure.

if price leaves the range, the breakout engine checks displacement and relative volume before registering a range break.

after a confirmed break, the retest engine can identify a return to the broken rail when the configured conditions are satisfied.

for stricter detection, increase the number of required factors, increase the confirmation period, or tighten the individual factor thresholds.

for more responsive detection, reduce the confirmation requirements while understanding that this can increase the number of detected structures.

how the script can help

range detector v3 is designed to make consolidation structures easier to identify and analyze.

it can help distinguish compressed or non-directional market conditions from stronger directional environments, visualize the boundaries and internal structure of a consolidation, track where price is positioned inside a confirmed range, identify displacement-based range breaks with volume participation, and monitor subsequent retests.

it can also be used as contextual information alongside other trading methods. for example, traders can use the detected rails, midpoint, quartiles, poc, premium/discount areas, breakout events, and retests as additional structural references when building their own setups.

the script also exposes hidden outputs for range high, range low, range state, factor score, adx, choppiness, bandwidth percentile, and slope, and includes alert conditions for range confirmation, bullish and bearish range breaks, and bullish and bearish retests.

range detector v3 is an analytical tool. its signals describe conditions detected by the configured model and should not be interpreted as guaranteed trade outcomes.

Exención de responsabilidad

La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.