OPEN-SOURCE SCRIPT

Volume Percentage

122
//version=5
indicator("Volume Percentage", overlay=false)

// Input for the length of the period to calculate average volume
length = input.int(20, title="Average Volume Length", minval=1)

// Calculate the average volume over the specified length
avg_volume = ta.sma(volume, length)

// Calculate the volume percentage
volume_percent = (volume / avg_volume) * 100

// Plot the volume percentage
plot(volume_percent, title="Volume %", color=color.blue, linewidth=2)

// Optional: Add a horizontal line for 100% (baseline)
hline(100, title="100% Baseline", color=color.gray, linestyle=hline.style_dotted)

// Display the volume percentage value on the chart
label_text = "Vol %: " + str.tostring(volume_percent, "#.##") + "%"
label.new(bar_index, volume_percent, label_text, style=label.style_label_down, color=color.blue, textcolor=color.white)

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.