OPEN-SOURCE SCRIPT

Volume Price Trend (VPT)

By BiggWigg
Updated

The Volume Price Trend (VPT) is a technical analysis indicator that combines price and volume data. It's used to identify the direction of a trend or to confirm the strength of a trend. The indicator was developed on the premise that volume often precedes price.

Working of VPT:

VPT is calculated by adding or subtracting a multiple of the percentage change in the share price trend and current volume, depending upon the direction of the share price. The starting point of the VPT line is arbitrary.

The formula for calculating VPT is:

VPT = Previous VPT + Volume x (Today's Close - Previous Close)

This formula adds the total volume traded on the days the price went up, and subtracts the total volume on the days the price went down.

For each period:

If the closing price is higher than the previous closing price, the volume for that period is added to the previous VPT.
If the closing price is lower than the previous closing price, the volume for that period is subtracted from the previous VPT.
If the closing price is the same as the previous closing price, the volume for that period does not affect the VPT (i.e., it remains the same as the previous VPT).

Usage and Interpretation of VPT:

The primary use of the VPT is to help confirm the condition of prices. It’s usually used in combination with other technical analysis indicators. Here are some ways traders use the VPT:

Trend Confirmation: A rising VPT line typically confirms an uptrend as it shows that volume is increasing as prices increase. Conversely, a falling VPT line confirms a downtrend.

Divergences: Traders often look for divergences between the VPT and price movements as a sign of upcoming reversals. If prices are rising and the VPT is falling, it suggests that the upward trend may not sustain because it isn't being supported by volume. Similarly, if prices are falling and the VPT is rising, it suggests the downward trend may reverse soon.

Change in Trend: A sudden sharp increase in the VPT could signal a possible change in trend. This is based on the belief that volume changes before price.

In the script provided, the VPT is calculated and then rescaled to a 0-100 scale, which makes it easier to compare across different stocks or time periods. This script also colors the VPT line based on whether it's increasing or decreasing. The color is green when VPT is increasing, and red when it's decreasing.

Enjoy!
Release Notes
Added an option for smoothing via SMA
Oscillators

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 publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer