OPEN-SOURCE SCRIPT

CVD Polarity Indicator (With Rolling Smoothed)

114
📊 CVD Polarity Indicator (with Rolling Smoothing)
Purpose

The CVD Polarity Indicator combines Cumulative Volume Delta (CVD) with price bar direction to measure whether buying or selling pressure is in agreement with price action. It then smooths that signal over time, making it easier to see underlying volume-driven market trends.

This indicator is essentially a volume–price agreement oscillator:
- It compares price direction with volume delta (CVD).
- Translates that into per-bar polarity.
- Smooths it into a rolling sum for clarity.
- Adds a short EMA to highlight turning points.

The end result: a tool that helps you see when price action is backed by real volume flows versus when it’s running on weak participation.

__________________________________________________________________________________

1. Cumulative Volume Delta (CVD)

What it is:
CVD is the cumulative sum of buying vs. selling pressure measured by volume.
- If a bar closes higher than it opens → that bar’s volume is treated as buying pressure (+volume).
- If a bar closes lower than it opens → that bar’s volume is treated as selling pressure (–volume).

Rolling version:
Instead of accumulating indefinitely (which just creates a line that trends forever), this indicator uses a rolling sum over a user-defined number of bars (cumulation_length, default 14).

- This shows the net delta in recent bars, making the CVD more responsive and localized.


2. Bar Direction vs. CVD Change
Each bar has two pieces of directional information:

1. Bar direction: Whether the candle closed above or below its open (close - open).
2. CVD change: Whether cumulative delta increased or decreased from the prior bar (cvd - cvd[1]).

By comparing these two:
- Agreement (both up or both down):
→ Polarity = +volume (if bullish) or –volume (if bearish).
- Disagreement (bar up but CVD down, or bar down but CVD up):
→ Polarity flips sign, signaling divergence between price and volume.

Thus, raw polarity = a per-bar measure of whether price action and volume delta are in sync.


3. Polarity Smoothing (Rolling Polarity)

- Problem with raw polarity:
It flips bar-to-bar and looks very jagged — not great for seeing trends.

- Solution:
The indicator applies a rolling sum over the past polarity_length bars (default 14).
- This creates a smoother curve, representing the net polarity over time.
- Positive values = net bullish alignment (buyers stronger).
- Negative values = net bearish alignment (sellers stronger).

Think of it like an oscillator showing whether buyers or sellers have had control recently.


4. EMA Smoothing

Finally, a 10-period EMA is applied on top of the rolling polarity line:
- This further reduces noise.
- It helps highlight shifts in the underlying polarity trend.
- Crossovers of the polarity line and its EMA can serve as trade signals (bullish/bearish inflection points).

________________________________________________________________________________


How to Read It

1. Polarity above zero → Recent bars show more bullish agreement between price and volume.
2. Polarity below zero → Recent bars show more bearish agreement.
3. Polarity diverging from price → If price goes up but polarity trends down, it signals weakening buying pressure (potential reversal).
4. EMA crossovers →
- Polarity crossing above its EMA = bullish momentum shift.
- Polarity crossing below its EMA = bearish momentum shift.


Practical Use Cases

- Trend Confirmation
Use polarity to confirm whether a price move is supported by volume. If price rallies but
polarity stays negative, the move is weak.
- Divergence Signals
Watch for divergences between price trend and polarity trend (e.g., higher highs in price but
lower highs in polarity).
- Momentum Shifts
Use EMA crossovers as signals that the underlying balance of buying/selling has flipped.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.