OPEN-SOURCE SCRIPT
Average Volume Label

Average Volume Label Indicator
This TradingView Pine Script creates a customizable label that displays the average trading volume over a specified period directly on your price chart.
Core Functionality:
Calculates the simple moving average (SMA) of volume over a user-defined number of days (default: 20 days)
Displays this average in a positioned label at the top of the chart
The label shows text like "20-Day Avg Volume: 1.2M" with automatic volume formatting
Key Customization Options:
Volume Calculation:
Adjustable lookback period (1-200 days) for the volume average
Label Appearance:
Text color, background color, and transparency controls
Five size options (Tiny to Huge)
Configurable horizontal position (how many bars back from the current bar to place the label)
Technical Implementation:
Updates only on the most recent bar to optimize performance
Positions the label at the highest price point within the visible range for consistent top-of-chart placement
Includes safety checks to prevent runtime errors with lookback periods
Also plots the average volume data (visible in the data window for reference)
This indicator is useful for traders who want to quickly assess whether current volume is above or below the recent average without cluttering their chart with additional panes.
This TradingView Pine Script creates a customizable label that displays the average trading volume over a specified period directly on your price chart.
Core Functionality:
Calculates the simple moving average (SMA) of volume over a user-defined number of days (default: 20 days)
Displays this average in a positioned label at the top of the chart
The label shows text like "20-Day Avg Volume: 1.2M" with automatic volume formatting
Key Customization Options:
Volume Calculation:
Adjustable lookback period (1-200 days) for the volume average
Label Appearance:
Text color, background color, and transparency controls
Five size options (Tiny to Huge)
Configurable horizontal position (how many bars back from the current bar to place the label)
Technical Implementation:
Updates only on the most recent bar to optimize performance
Positions the label at the highest price point within the visible range for consistent top-of-chart placement
Includes safety checks to prevent runtime errors with lookback periods
Also plots the average volume data (visible in the data window for reference)
This indicator is useful for traders who want to quickly assess whether current volume is above or below the recent average without cluttering their chart with additional panes.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
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.