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.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que la republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no pretenden ser, ni constituyen, asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que la republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no pretenden ser, ni constituyen, asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.