Plain Stochastic Divergence
Aug 15, 2019

The Plain Stochastic Divergence indicator provides a streamlined method for identifying regular and hidden divergences between price action and the Stochastic oscillator.
Usage
The Plain Stochastic Divergence tool is used to identify potential trend reversals or continuations by spotting discrepancies between price peaks/troughs and the Stochastic %K line.
- Regular Bullish Divergence: Occurs when price makes a lower low, but the Stochastic makes a higher low. This suggests a potential upward reversal.
- Regular Bearish Divergence: Occurs when price makes a higher high, but the Stochastic makes a lower high. This suggests a potential downward reversal.
- Hidden Bullish Divergence: Occurs when price makes a higher low, but the Stochastic makes a lower low. This often indicates trend continuation.
- Hidden Bearish Divergence: Occurs when price makes a lower high, but the Stochastic makes a higher high. This often indicates trend continuation.
The indicator plots dots on the oscillator lines to mark these divergences and includes diamond shapes at the top or bottom of the indicator pane for quick visual reference.
Details
The script calculates the Stochastic %K and %D lines using standard smoothing techniques. Divergences are detected based on "Fractals," which are defined by the Fractal Depth setting. A peak or trough is confirmed only when it is the highest or lowest value within a specific lookback and lookahead range (determined by the depth). Because this requires looking at future bars relative to the pivot point, divergence signals are plotted with an offset to align with the actual peak or trough in the past.
This implementation is based on concepts from the Double Stochastic Divergence script by various community contributors.
Settings
Stochastic
- K: The period used for the raw Stochastic calculation.
- D: The period used for the moving average of the %K line (the %D line).
- Smooth: The smoothing period applied to the raw Stochastic values to create the %K line.
Divergence
- Fractal Depth: Determines the number of bars required on either side of a high or low to confirm a pivot point. Increasing this value results in fewer, more significant divergence signals, while decreasing it provides more frequent signals.
FAQ
How do I use the Plain Stochastic Divergence?
You can look for color-coded plots on the oscillator lines. Green shades represent bullish divergences, while red shades represent bearish divergences. These can be used to supplement existing trading strategies focused on momentum or trend reversals.
What is the difference between regular and hidden divergence?
Regular divergences typically signal a potential trend reversal, while hidden divergences typically signal that the current trend is likely to continue after a retracement.
How can I access this tool?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.