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)

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.