OPEN-SOURCE SCRIPT

Price Volume Trendline

The Price Volume Trendline indicator calculates and displays a linear regression trendline based on the product of volume and price (e.g., Volume * Close, Volume * Open, etc.) for a specified timeframe. The indicator helps visualize the relationship between price and volume movements over time.

Note - Please choose a timeframe to display the trendline.

Key Features:

Linear Regression: The trendline is computed using a linear regression of Volume * Price values over a user-defined length (length_trend), providing a smoothed representation of the trend.

Color Coding: The trendline color changes dynamically:
Green: When the slope of the trendline is positive (indicating an uptrend in Volume * Price).
Red: When the slope of the trendline is negative (indicating a downtrend in Volume * Price).
Customizable Timeframe: Users can choose the timeframe for the Volume * Price calculation (either "auto" for the chart's timeframe or a custom timeframe).

This indicator is useful for identifying long-term trends in the relationship between price and volume, highlighting bullish or bearish conditions based on both price and volume dynamics.

Please feel free to share your feedback. That would be appreciated!
Linear RegressionPrice Volume Trend (PVT)

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