Inertial Oscillator [nikaquant]The Inertial Oscillator is an adaptive momentum indicator that combines a dominant cycle detector with an inertia-preserving RSI to produce a smoother, more market-aware oscillator. Rather than fixing a single lookback period, it continuously senses the rhythm of the market and selects the RSI length that best preserves continuity from the previous bar — keeping the signal stable during trends and responsive during reversals. A built-in Phase Clock, divergence scanner, and split histogram complete the suite.
HOW IT WORKS
Adaptive Dominant Cycle — Pearson autocorrelation across bar lags (min 8, max 20) detects the market's current dominant cycle period. EMA-smoothed to prevent erratic jumps, recalculated every N bars for efficiency.
Inertial RSI — RSI is computed at every period length in range. The script picks whichever value is closest to the previous bar's RSI — keeping the oscillator anchored during trends and naturally adaptive in cycles. Adapts without snapping.
Phase Clock — RSI + its derivative are mapped to four quadrants: RISING (0–90°), TOPPING (90–180°), FALLING (180–270°), BOTTOMING (270–360°). A live clockface ring in the info table shows where momentum stands in the cycle.
Divergence Detection — Pivot-based scanner finds regular bullish divergences (price LL, RSI HL) and regular bearish divergences (price HH, RSI LH). Labels plotted directly at the pivot on the oscillator pane.
Split-at-50 Histogram — Bars centered on the 50 midline. Green above = bullish momentum. Red below = bearish. Colors intensify at overbought/oversold extremes.
Exit Signals — Fires only when RSI crosses the adaptive signal line AND is in overbought/oversold territory simultaneously. Filters out midrange noise, shows only high-conviction exhaustion points.
SIGNALS
Phase transitions TOPPING → FALLING or BOTTOMING → RISING mark potential inflection points
Bullish divergence near oversold levels — weakening downside momentum
Bearish divergence near overbought levels — weakening upside momentum
Exit markers at exhaustion: RSI stretched + signal line crossed
SETTINGS
Adaptive Period — Min/max lag range, EMA smoothing alpha, recalculation interval
Oscillator — Overbought/oversold levels (also gates exit signal filter)
Divergence — Pivot bars, min/max lookback range between pivots
Style — Text size, line width, full color control for all elements
USAGE NOTES
The adaptive period in the info table tells you which cycle length is driving the oscillator. A rising or falling number means the market is shifting tempo.
Phase Clock is context, not a direct signal — use it to gauge whether momentum is accelerating or decelerating within a trend.
Divergences are strongest at overbought/oversold extremes, especially when they coincide with a Phase Clock quadrant transition.
Lower timeframes: widen the max period for slower cycles. Higher timeframes: tighter bounds for faster detection.
The inertial RSI is intentionally quieter than fixed-period RSI during sustained moves. This is by design, not lag.
Wskaźnik Pine Script®






















