OPEN-SOURCE SCRIPT
Adaptive Divergence Core [JOAT]

Adaptive Divergence Core is an open-source Pine Script v6 oscillator that combines HMA-smoothed RSI behavior, adaptive percentile bands, confirmed divergence lines, and regime fills. It is designed to make oscillator extremes relative to the current chart sample instead of relying only on fixed overbought and oversold levels.
The script is useful when standard oscillator thresholds are too rigid. A market can stay strong or weak for long periods. Adaptive Divergence Core recalculates upper and lower fields from recent oscillator distribution, then plots confirmed divergence only after both price and oscillator pivots are confirmed.

Core Concepts
1. HMA-RSI Core
The oscillator blends RSI on raw price, RSI on HMA-smoothed price, and an HMA-smoothed RSI value. It is centered around zero for easier bullish and bearish reading.
Pine Script®
2. Adaptive Percentile Bands
The upper and lower bands are calculated from rolling percentiles of the oscillator. This lets the bands adapt to the recent distribution of momentum.
Pine Script®
3. Extreme Fields
Additional 95th and 5th percentile fields help show deeper oscillator stretch zones beyond the primary adaptive bands.
4. Confirmed Divergence Detection
Bearish divergence requires price to form a higher confirmed pivot high while the oscillator forms a lower confirmed pivot high. Bullish divergence requires price to form a lower confirmed pivot low while the oscillator forms a higher confirmed pivot low.
5. Regime Fill
The script fills the oscillator against zero and against its guide line, making positive and negative regimes easy to read without large markers.
Features
Input Parameters
Core:
Adaptive Bands:
Divergence:
Visuals:
How to Use This Indicator
Step 1: Read the Core Relative to Zero
Values above zero show positive oscillator regime. Values below zero show negative oscillator regime.
Step 2: Use Adaptive Bands
When core enters the upper or lower adaptive band, momentum is stretched relative to its recent sample.
Step 3: Evaluate Divergence After Confirmation
Divergence lines are delayed by pivot confirmation. This is intentional and avoids projecting unconfirmed pivots into the past.
Indicator Limitations
Originality Statement
Adaptive Divergence Core is original in its HMA-RSI blend, rolling percentile threshold system, confirmed pivot divergence logic, and compact dashboard. It uses public Pine v6 functions to build a distinct oscillator workflow.
Disclaimer
This script is provided for educational and informational use only. It is not financial advice or a recommendation to buy or sell any financial instrument. Trading involves substantial risk of loss. Oscillator divergences can fail or remain early for extended periods. Always use independent analysis and proper risk management.
-Made with passion by jackofalltrades
The script is useful when standard oscillator thresholds are too rigid. A market can stay strong or weak for long periods. Adaptive Divergence Core recalculates upper and lower fields from recent oscillator distribution, then plots confirmed divergence only after both price and oscillator pivots are confirmed.
Core Concepts
1. HMA-RSI Core
The oscillator blends RSI on raw price, RSI on HMA-smoothed price, and an HMA-smoothed RSI value. It is centered around zero for easier bullish and bearish reading.
hmaSource = ta.hma(src, hmaLen)
rawRsi = ta.rsi(src, rsiLen)
rsiOnHma = ta.rsi(hmaSource, rsiLen)
smoothedRsi = ta.hma(rawRsi, smoothLen)
core = (rsiOnHma * 0.58 + smoothedRsi * 0.42) - 50.0
2. Adaptive Percentile Bands
The upper and lower bands are calculated from rolling percentiles of the oscillator. This lets the bands adapt to the recent distribution of momentum.
upperRaw = ta.percentile_nearest_rank(core, percentileLength, upperPercentile)
lowerRaw = ta.percentile_nearest_rank(core, percentileLength, lowerPercentile)
3. Extreme Fields
Additional 95th and 5th percentile fields help show deeper oscillator stretch zones beyond the primary adaptive bands.
4. Confirmed Divergence Detection
Bearish divergence requires price to form a higher confirmed pivot high while the oscillator forms a lower confirmed pivot high. Bullish divergence requires price to form a lower confirmed pivot low while the oscillator forms a higher confirmed pivot low.
5. Regime Fill
The script fills the oscillator against zero and against its guide line, making positive and negative regimes easy to read without large markers.
Features
- HMA-RSI oscillator: Blends raw RSI, RSI on HMA, and smoothed RSI
- Adaptive percentile bands: Upper and lower thresholds adjust to recent oscillator behavior
- Extreme bands: Additional outer fields for deeper stretch readings
- Confirmed divergence lines: Divergences plot only after price and oscillator pivots confirm
- Divergence labels: Small S Div and B Div labels are placed near confirmed divergence lines
- Divergence line cap: Old lines are deleted to respect object limits
- Optional candle tint: Can color chart candles from the oscillator pane setting
- Dashboard: Shows core value, bands, divergence counts, and current field
- Alerts: Divergence, band entry, and band release conditions
Input Parameters
Core:
- Source: Price source
- RSI Length: Base RSI period
- HMA Price Length: HMA source smoothing
- HMA RSI Smooth: Smoothing for the raw RSI component
Adaptive Bands:
- Percentile Length: Lookback used for adaptive thresholds
- Upper Percentile: Upper adaptive threshold percentile
- Lower Percentile: Lower adaptive threshold percentile
Divergence:
- Divergence Left Bars / Right Bars: Pivot confirmation settings
- Maximum Divergence Lines: Object cap for plotted divergence lines
- Divergence Labels: Shows or hides compact divergence labels
Visuals:
- Tint Candles: Optional candle tint from the oscillator state
- Show Dashboard: Shows or hides the compact top-right pane dashboard
- Palette: Selects the local JOAT color preset
How to Use This Indicator
Step 1: Read the Core Relative to Zero
Values above zero show positive oscillator regime. Values below zero show negative oscillator regime.
Step 2: Use Adaptive Bands
When core enters the upper or lower adaptive band, momentum is stretched relative to its recent sample.
Step 3: Evaluate Divergence After Confirmation
Divergence lines are delayed by pivot confirmation. This is intentional and avoids projecting unconfirmed pivots into the past.
Indicator Limitations
- Divergences confirm late because pivots need right-side bars
- Adaptive bands depend on the selected lookback and can shift over time
- Divergence is context, not a complete trade plan
- During strong trends, oscillator stretch can persist for many bars
Originality Statement
Adaptive Divergence Core is original in its HMA-RSI blend, rolling percentile threshold system, confirmed pivot divergence logic, and compact dashboard. It uses public Pine v6 functions to build a distinct oscillator workflow.
Disclaimer
This script is provided for educational and informational use only. It is not financial advice or a recommendation to buy or sell any financial instrument. Trading involves substantial risk of loss. Oscillator divergences can fail or remain early for extended periods. Always use independent analysis and proper risk management.
-Made with passion by jackofalltrades
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
The AI Trading Ecosystem, Built to win trades 📈
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
The AI Trading Ecosystem, Built to win trades 📈
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.