Weighted Oscillator Convergence Divergence

The Weighted Oscillator Convergence Divergence (WOCD) aims to help traders identify potential trend reversals or momentum shifts in financial markets by calculating and visualizing the difference between a smoothed oscillator (WMA) value and its exponential moving average (EMA) and simple moving average (SMA) counterparts. This indicator is particularly useful for traders who want an alternative perspective on price momentum and divergence.

Key Features:


Length: The user can specify the number of bars to consider for calculations (default is 9).
Smoothing 1: Defines the smoothing factor for the first smoothed value (default is 5).
Smoothing 2: Specifies the smoothing factor for the second smoothed value (default is 7).
Ma Type: There are three types of moving averages you can choose (Wilder, non-lag, Weighted is by default).
Color Settings: Users can customize the indicator's colors for various elements, such as length, smoothing values, and different sections of the histogram.

WOCD calculates the raw oscillator value by subtracting the close price from a 3-period High, Low, Close (HLC3) moving average.
It then applies smoothing to this raw oscillator value using two different methods: exponential moving average (EMA) and simple moving average (SMA) with user-defined smoothing periods.
Histogram Plot:

The indicator plots a histogram based on the difference between the smoothed oscillator and the first smoothed value.
When the histogram is above zero and rising, it is colored according to the "Above Grow" color setting. When it's above zero and falling, it uses the "Fall" color for visualization.
Similarly, when the histogram is below zero and rising, it is colored according to the "Below Grow" color setting, and when it's below zero and falling, it uses the "Fall" color.
Oscillator and Smoothed Values:

The indicator also plots the smoothed oscillator, smoothed value 1 (EMA-based), and smoothed value 2 (SMA-based) on the chart.
Zero Line:

A horizontal line at zero is drawn on the chart for reference.
How to Use the WOCD Indicator:

Trend Identification: Observe the histogram's direction and color. A rising histogram above zero may indicate bullish momentum, while a falling histogram below zero could signal bearish momentum.

Divergence: Look for divergences between price action and the histogram. When the histogram and price move in opposite directions, it can be a potential reversal signal.

Crossovers: Pay attention to crossovers between the smoothed oscillator and its smoothed counterparts (EMA and SMA). These crossovers can indicate changes in trend strength or direction.

Zero Line: The zero line can act as a reference point. Positive histogram values suggest bullish sentiment, while negative values indicate bearish sentiment.

Comparison to MACD Indicator:
The WOCD indicator shares some similarities with the Moving Average Convergence Divergence (MACD) indicator but also has distinct differences:


Both WOCD and MACD are momentum oscillators designed to identify potential trend reversals and divergences.
They use moving averages (EMA in the case of MACD) to smooth the raw oscillator values.
Both indicators provide histogram representations of the difference between the oscillator and its smoothed counterpart.

WOCD uses a 3-period High, Low, Close (HLC3) moving average to calculate the raw oscillator value, whereas MACD uses the difference between two exponential moving averages (usually 12-period and 26-period EMAs).
The smoothing in WOCD employs both EMA and SMA, while MACD exclusively uses EMA.
WOCD allows users to customize colors for various elements, enhancing visual clarity.

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?