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))
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
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.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
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.