Stochastic Adaptive %D [LuxAlgo]The Stochastic Adaptive %D Difference Oscillator indicator provides a sophisticated alternative to classic momentum oscillators, prioritizing a balance between high-grade smoothing and adaptive reactivity. By calculating the divergence between a pre-smoothed Stochastic %D and a specialized Adaptive %D signal line, this tool highlights momentum shifts with significantly reduced noise while maintaining the ability to react quickly to trend accelerations.
🔶 USAGE
This indicator is designed for traders who require the clarity of a smooth oscillator without the lag typically associated with heavy filtering. The "Difference Oscillator" component serves as the primary visual guide, representing the spread between momentum and its adaptive average.
🔹 Signal Generation
The indicator features three main visual components:
Standard %D Line: A dual-smoothed stochastic calculation that acts as the core momentum measure, plotted as a dotted line.
Adaptive %D Line: A reactive signal line that adjusts its smoothing alpha based on market intensity, plotted as a dashed line.
Difference Oscillator: A histogram-style fill centered at the 50 midline. This represents the momentum "delta"—when price velocity accelerates away from the adaptive baseline, the oscillator expands, providing earlier warning of trend strength or exhaustion.
When the Standard %D leads the Adaptive %D, the oscillator fills green, suggesting bullish momentum. When it lags, it fills red, suggesting bearish momentum. The expansion and contraction of this fill help identify whether a trend is gaining or losing "torque" relative to its adaptive mean.
🔶 DETAILS
The script achieves its unique balance through a specialized architectural approach that focuses on conserving smoothness while remaining reactive to volatile shifts.
🔹 Smoothness Conservation
To eliminate the "jaggedness" often found in standard Stochastics, the indicator applies a pre-smoothing filter (SMA) to the High, Low, and Close sources. This ensures that the foundation of the calculation is filtered for noise before the Stochastic formula is even applied, resulting in much cleaner oscillations.
🔹 Adaptive Reactivity
The Adaptive %D signal line employs a variable alpha smoothing mechanism. The "speed" of the signal line is dynamically linked to the position of the %D relative to the 50 midline.
Trend Extremes: As momentum reaches overbought (80) or oversold (20) zones, the alpha increases. This allows the signal line to track the %D more aggressively, capturing the peak of the move.
Mean Reversion/Ranging: Near the 50 midline, the alpha decreases, making the signal line more "stubborn" and less prone to whipsaws during low-conviction market phases.
🔶 SETTINGS
🔹 Stochastic Settings
Stochastic Length: The lookback period used for the raw stochastic range calculation.
%K Smoothing: Determines the internal smoothing applied to produce the standard %D line.
Price Pre-Smoothing: The length of the SMA applied to price sources before the oscillator is calculated to ensure foundational smoothness.
🔹 Adaptive Smoothing Settings
Attenuation Factor: A sensitivity multiplier that controls the reactivity of the Adaptive %D. Higher values increase the "inertia" of the adaptive calculation, making the signal line more conservative.
🔹 Colors
Standard %D Color: Sets the color for the core momentum dotted line.
Adaptive %D Color: Sets the color for the reactive signal dashed line.
Bullish/Bearish Color: Defines the colors used for the Difference Oscillator's gradient fill.
Индикатор Pine Script®






















