OPEN-SOURCE SCRIPT

Percentile Adaptive RSI | NAL

1 513
What if RSI thresholds adapted to the market's own momentum distribution, rather than remaining fixed at arbitrary levels?

Percentile Adaptive RSI is a statistically adaptive momentum framework that combines two distinct RSI measurements with dynamically estimated percentile thresholds.

Traditional RSI interpretation relies heavily on fixed reference levels, typically 30 and 70, regardless of how an asset's momentum distribution changes over time.

This model takes a different approach.

Instead of assuming that the same RSI values should carry identical significance across different market environments, it continuously evaluates momentum relative to its own recent statistical distribution.

A second RSI, calculated from a rolling price-percentile series, introduces an additional layer of momentum confirmation.

The result is a dual-RSI consensus model in which directional classifications depend on both momentum agreement and statistically adaptive thresholds.

1. Price Percentile Transformation

The first component constructs a rolling percentile estimate of the underlying price series.

Rather than directly smoothing price through a conventional moving average, the model identifies a specified quantile within the most recent observations.

Pine Script®


At the default 50th percentile, this produces a rolling median of the selected source.

The percentile parameter can be adjusted to examine different portions of the local price distribution.

This transformed price series becomes the input to a second RSI calculation.

2. Dual-RSI Momentum Structure

The framework calculates two complementary momentum measurements:

  1. Standard RSI — measures conventional momentum directly from the selected price source.
  2. Percentile RSI — measures momentum in the rolling percentile-transformed price series.


Pine Script®


The distinction is important.

The standard RSI responds directly to changes in the source, while the percentile-based RSI evaluates changes in a distribution-derived representation of price.

Comparing both measurements introduces a confirmation requirement between direct price momentum and percentile-transformed momentum.

3. Adaptive Percentile Thresholds

Conventional RSI indicators generally rely on fixed horizontal reference levels.

Percentile Adaptive RSI instead calculates its directional boundaries from the recent distribution of the standard RSI itself.

Pine Script®


These boundaries evolve as the RSI distribution changes.

  1. Upper Percentile — defines the statistical boundary for elevated momentum.
  2. Lower Percentile — defines the statistical boundary for subdued momentum.


For example, an upper percentile setting of 60 represents the 60th percentile of recent RSI observations, not a fixed RSI value of 60.

This allows the model to evaluate momentum relative to its recent behavior rather than relying on universal numerical levels.

4. Directional Consensus

The final directional state requires agreement between both RSI measurements.

Pine Script®


  1. Bullish — both momentum measurements exceed the adaptive upper threshold.
  2. Bearish — both momentum measurements fall below the adaptive lower threshold.
  3. Transition / Disagreement — the requirements for a new directional state are not satisfied.


When the two components disagree or remain between the required thresholds, the model preserves its previously established directional classification.

This persistence mechanism separates isolated threshold fluctuations from changes that satisfy the complete dual-RSI condition.

Visuals & Interpretation

The oscillator provides a streamlined representation of the prevailing momentum regime.

During qualifying bullish conditions, the displayed series selects the higher of the two RSI measurements. During qualifying bearish conditions, it selects the lower measurement. When neither condition is satisfied, the plotted value remains at its previous level.

The visualization includes:

  1. A dynamically colored momentum oscillator.
  2. Adaptive upper and lower percentile boundaries.
  3. Directional gradient fills extending toward the opposing percentile boundary.
  4. Persistent bullish and bearish regime coloration.
  5. Trend-colored candles on the main chart.
  6. Three color presets: Standard, Nordic, and Simple.


Practical Application

Percentile Adaptive RSI is designed to analyze relative momentum strength, distribution-adjusted directional conditions, and agreement between two representations of price momentum.

Its central distinction is that momentum is not evaluated against an unchanging numerical standard.

Instead, the indicator continuously asks:

Is current momentum sufficiently strong or weak relative to its recent distribution, and does that assessment remain consistent after transforming price through a rolling percentile filter?

By combining distribution-aware thresholds with dual-RSI confirmation, the model provides an alternative to conventional fixed-threshold RSI interpretation.

Automated Alerts

Two built-in alerts monitor directional state transitions:

  1. Bullish Transition — triggers when the model enters a bullish regime.
  2. Bearish Transition — triggers when the model enters a bearish regime.


Both alerts require confirmation of the completed bar and activate only when the directional state changes.

Configuration

Users can independently configure the source, RSI observation length, price percentile, upper and lower RSI percentile thresholds, and visual color scheme.

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。