OPEN-SOURCE SCRIPT
Average Volume

//version=5
indicator("Average Daily Volume", overlay=false)
// --- Inputs
lookback = input.int(20, "Lookback Period (Days)", minval=1)
// --- Convert chart timeframe to daily volume
// If you’re on intraday, TradingView aggregates intraday bars belonging to a single day
is_new_day = ta.change(time("D")) != 0
daily_volume = ta.valuewhen(is_new_day, volume, 0)
// --- Average daily volume
avg_daily_volume = ta.sma(daily_volume, lookback)
// --- Plot
plot(avg_daily_volume, title="Avg Daily Volume", color=color.new(color.blue, 0))
indicator("Average Daily Volume", overlay=false)
// --- Inputs
lookback = input.int(20, "Lookback Period (Days)", minval=1)
// --- Convert chart timeframe to daily volume
// If you’re on intraday, TradingView aggregates intraday bars belonging to a single day
is_new_day = ta.change(time("D")) != 0
daily_volume = ta.valuewhen(is_new_day, volume, 0)
// --- Average daily volume
avg_daily_volume = ta.sma(daily_volume, lookback)
// --- Plot
plot(avg_daily_volume, title="Avg Daily Volume", color=color.new(color.blue, 0))
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
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.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
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.