OPEN-SOURCE SCRIPT
Aggiornato

Zero Lag CVD, RSI & Stochastic Divergence (All-in-One) [D4A]

18 053
Zero Lag CVD, RSI, Stochastic Divergence

Overview

Zero-Lag Divergence indicator is designed to identify bullish and bearish divergences as they happen, without relying on traditional pivot confirmation delays. By comparing price action with output of CVD, RSI and Stochastic across two independent detection periods, the indicator helps traders spot potential trend exhaustion and reversal opportunities earlier than conventional divergence tools.

How is this indicator different from other similar tools?

- Provides real-time non-repainting divergence signals for CVD, RSI and Stochastic in one convenient script
- Provides instant and separate divergence signals for one of the three oscillators (CVD, RSI, Stochastic), combination of two oscillators or combination of all three (Agreement Mode), thus marking double or triple confirmation of discrepancy between the price, momentum and volume, signalling potentially important reversal zone.
- To maximize probability of validity of the signal, the user can configure overbought and oversold conditions for both momentum oscillators (RSI & Stochastic) to filter only the strongest signals.
- To keep chart clutter under control the tool combines divergence labels into one common label in Agreement Mode
- The indicator tracks divergence simultaneously using two different and configurable periods (short- and long-term divergence) thus allowing to track shorter and longer periods for possible divergences while using only one timeframe
- Displays all signals directly on the chart - no need for additional panel below or above the chart
- All three oscillators can be independently configured, eg. signal length, smoothing, overbought and oversold levels.

Bullish Divergence Logic
Occurs when price forms a lower low while oscillator forms a higher low, suggesting weakening bearish momentum (volume) and the possibility of an upward reversal.

Bearish Divergence Logic
Occurs when price forms a higher high while oscillator forms a lower high, indicating weakening bullish momentum (volume) and the potential for a downward move.

Why Zero-Lag?

Most divergence indicators require future candle confirmation before displaying a signal. This indicator prioritizes immediacy by highlighting potential divergences as they form, allowing traders to react sooner to developing momentum shifts.

While this approach can generate earlier opportunities, it may also create false signals and market noise. For best results, consider combining divergence signals with trend analysis, support and resistance levels, volume studies, or additional confirmation tools.

Notes

* Signals are non-repainting once generated.
* Earlier detection may result in more frequent signals compared to traditional pivot-confirmed divergence indicators.
* Suitable for stocks, forex, cryptocurrencies, indices, and other liquid markets.
* Can be used on any timeframe, from intraday trading to higher-timeframe swing analysis.

SETTINGS

- Zero-Lag Divergence - enable the display of signals

- Mode - select for which oscillator should divergence signals be plotted:
CVD - Cumulative Volume Delta
RSI - Relative Strength Index
Stochastic - Momentum oscillator
Agreement - two or three indicators agree at the same time (same candle)

- Minimum Agreement - how many indicators should agree at the same time: Any Two or Any Three

- Cumulative Volume Delta Length

- RSI Length, OB (overbought) level , OS (oversold) level. OB and OS levels can be used to select more extreme zones to find divergence (stronger signals).

- Stochastic: %K and Smoothing settings, as well as OB and OS settings (work similar to RSI logic)

- Show Labels - show labels on the chart

- Bullish Label - can be set and color coded for different indicators

- Bearish Label - can be set and color coded for different indicators

- All Oscillators Agree - displays label when all three oscillators generate divergence signals at the same time

- RSI + Stochastic - displays label when both RSI and Stochastic agree at the same time

- CVD + Stochastic - displays label when both CVD and Stochastic agree at the same time

- CVD + RSI - displays label when both CVD and RSI agree at the same time

- RSI Divergence Label only if RSI >=OB or RSI <= OS - display the label only when RSI divergence signals are detected at user-defined overbought or oversold levels

- Stochastic Divergence Label only if Stochastic >=OB or Stochastic <= OS - display the label only when Stochastic divergence signals are detected at user-defined overbought or oversold levels

- Show Lines - draw lines between divergence points.

- Short Period - define the 1st period for which divergence is detected

- Long Period - define the 2nd period for which divergence is detected

- Distance Multiplier & ATR - used to position the labels at specific distance from divergence point

What is CVD?
CVD measures the cumulative difference between buying and selling volume. A rising CVD indicates more buying pressure, while a falling CVD indicates more selling pressure. Divergence occurs when the price action contradicts the CVD's direction, suggesting a potential shift in momentum or trend reversal.

What is RSI?
The relative strength index (RSI) is a momentum indicator used to measures the speed and magnitude of a asset's recent price changes to detect overbought or oversold conditions.

What is Stochastic?
Trading View definition: Stochastic Oscillator (STOCH) is a range bound momentum oscillator. The Stochastic indicator is designed to display the location of the close compared to the high/low range over a user defined number of periods. Typically, the Stochastic Oscillator is used for three things; Identifying overbought and oversold levels, spotting divergences and also identifying bull and bear set ups or signals.

-----------------
Disclaimer

The content provided in this script is for educational and informational purposes only. It does not constitute financial advice, investment recommendations, or a solicitation to buy or sell any financial instruments. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.

All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
Note di rilascio
- Added functionality to change label text color
- Changed how the label distance is calculated. Set new default in 'Distance Multiplier'. You may need to play around with its value to find optimal display of the labels for the asset you are trading.
- Some minor bug fixes.
Note di rilascio
- Added new Agreement Mode: 'Two or Three' - will display divergence label for either when two or three oscillators agree. This is the default option.
- Added new display option: 'Show Short/Long Period Tag (S/L) on Agreement Labels'
- A few minor bug fixes
- Updated the chart picture

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.