The Stochastic Divergence indicator is an adaptation of the standard Stochastic Oscillator. It incorporates elements of divergence detection, which is a concept often applied to various oscillators including RSI and Stochastic. The code has been optimized and organized for clarity and efficiency, with non-essential visual elements like background shading removed.
Key Features and Improvements:
1. Customizable Divergence Detection:
- Added Lookback Right and Lookback Left parameters for divergence calculation.
- This addresses the "repainting" issue present in some indicators where signals appear several candles after the actual divergence occurs.
- By setting Lookback Right to 1, users can get divergence signals on the very next candle after the divergence occurs, improving timeliness of signals.
2. Stochastic Overbought and Oversold Signals:
- Incorporates traditional Stochastic overbought and oversold levels.
- Added alerts for when the Stochastic crosses these levels, providing potential trade entry or exit signals.
3. Stochastic Crossover Signals:
- Detects and alerts when the Stochastic %K line crosses the %D line.
- These crossovers can indicate potential trend reversals or continuations.
4. Multiple Alert Types:
- Divergence alerts (bullish and bearish)
- Overbought and oversold alerts
- Stochastic %K and %D crossover alerts
5. Customizable Settings:
- Users can adjust Stochastic parameters, MA types, divergence settings, and trigger lines to suit their trading style.