OPEN-SOURCE SCRIPT

RSI adaptive zones [AdaptiveRSI]

208
This script introduces a unified mathematical framework that auto-scales oversold/overbought and support/resistance zones for any period length. It also adds true RSI candles for spotting intrabar signals.

Built on the Logit RSI foundation, this indicator converts RSI into a statistically normalized space, allowing all RSI lengths to share the same mathematical footing.
What was once based on experience and observation is now grounded in math.

✦ ✦ ✦ ✦ ✦

💡 Example Use Cases
  1. RSI(14): Classic overbought/oversold signals + divergence
    لقطة
  2. Support in an uptrend using RSI(14)
    لقطة
  3. Range breakouts using RSI(21)
    لقطة
  4. Short-term pullbacks using RSI(5)
    لقطة


✦ ✦ ✦ ✦ ✦

THE PAST: RSI Interpretation Required Multiple Rulebooks

Over decades, RSI practitioners discovered that RSI behaves differently depending on trend and lookback length:
• In uptrends, RSI tends to hold higher support zones (40–50)
• In downtrends, RSI tends to resist below 50–60
• Short RSIs (e.g., RSI(2)) require far more extreme threshold values
• Longer RSIs cluster near the center and rarely reach 70/30

These observations were correct — but lacked a unifying mathematical explanation.

✦ ✦ ✦ ✦ ✦

THE PRESENT: One Framework Handles RSI(2) to RSI(200)

Instead of using fixed thresholds (70/30, 90/10, etc.), this indicator maps RSI into a normalized statistical space using:

• The Logit transformation to remove 0–100 scale distortion
• A universal scaling based on 2/√(n−1) scaling factor to equalize distribution shapes

As a result, RSI values become directly comparable across all lookback periods.

✦ ✦ ✦ ✦ ✦

💡 How the Adaptive Zones Are Calculated

The adaptive framework defines RSI zones as statistical regimes derived from the Logit-transformed RSI.
Each boundary corresponds to a standard deviation (σ) threshold, scaled by 2/√(n−1), making RSI distributions comparable across periods.

This structure was inspired by Nassim Nicholas Taleb’s body–shoulders–tails regime model:
  • Body (±0.66σ) — consolidation / equilibrium
  • Shoulders (±1σ to ±2.14σ) — trending region
  • Tails (outside of ±2.14σ) — rare, high-volatility behavior


Transitions between these regimes are defined by the derivatives of the position (CDF) function:
• ±1σ → shift from consolidation to trend
• ±√3σ → shift from trend to exhaustion

لقطة

Adaptive Zone Summary
  • Consolidation: −0.66σ to +0.66σ
  • Support/Resistance: ±0.66σ to ±1σ
  • Uptrend/Downtrend: ±1σ to ±√3σ
  • Overbought/Oversold: ±√3σ to ±2.14σ
  • Tails: outside of ±2.14σ

✦ ✦ ✦ ✦ ✦

📌 Inverse Transformation: From σ-Space Back to RSI

A final step is required to return these statistically normalized boundaries back into the familiar 0–100 RSI scale. Because the Logit transform maps RSI into an unbounded real-number domain, the inverse operation uses the hyperbolic tangent function to compress σ-space back into the bounded RSI range.

RSI(n) = 50 + 50 · tanh(z / √(n − 1))

The result is a smooth, mathematically consistent conversion where the same statistical thresholds maintain identical meaning across all RSI lengths, while still expressing themselves as intuitive RSI values traders already understand.

لقطة

✦ ✦ ✦ ✦ ✦

Key Features
  • Mathematically derived adaptive zones for any RSI period
  • Support/resistance zone identification for trend-aligned reversals
  • Optional OHLC RSI bars/candles for intrabar zone interactions
  • Fully customizable zone visibility and colors
  • Statistically consistent interpretation across all markets and timeframes


Inputs
  1. RSI Length — core parameter controlling zone scaling
  2. RSI Display: Line / Bar / Candle visualization modes

✦ ✦ ✦ ✦ ✦

💡 How to Use

This indicator is a framework, not a binary signal generator.
Start by defining the question you want answered, e.g.:

• Where is the breakout?
• Is price overextended or still trending?
• Is the correction ending, or is trend reversing?

Then:
  1. Choose the RSI length that matches your timeframe
  2. Observe which adaptive zone price is interacting with
  3. Interpret market behavior accordingly

Example: Long-Term Trend Assesment using RSI(200)
A trader may ask: "Is this a long term top?"
Unlikely, because RSI(200) holds above Resistance zone, therefore the trend remains strong.

لقطة

✦ ✦ ✦ ✦ ✦

👉 Practical tip:
If you used to overlay weekly RSI(14) on a daily chart (getting a line that waits 5 sessions to recalculate), you can now read the same long-horizon state continuously: set RSI(70) on the daily chart (~14 weeks × 5 days/week = 70 days) and let the adaptive zones update every bar.
Note: It won’t be numerically identical to the weekly RSI due to lookback period used, but it tracks the same regime on a standardized scale with bar-by-bar updates.

✦ ✦ ✦ ✦ ✦

Note: This framework describes statistical structure, not prediction. Use as part of a complete trading approach. Past behavior does not guarantee future outcomes.

framework ≠ guaranteed signal

---

Attribution & License
This indicator incorporates:
• Logit transformation of RSI
• Variance scaling using 2/√(n−1)
• Zone placement derived from Taleb’s body–shoulders–tails regime model and CDF derivatives
• Inverse TANH(z) transform for mapping z-scores back into bounded RSI space

Released under CC BY-NC-SA 4.0 — free for non-commercial use with credit.
© AdaptiveRSI

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.