OPEN-SOURCE SCRIPT

TSEP Dual SMA + Optional BB

31
//version=5
indicator("TSEP – 50-day ADTV & Current Volume", overlay=false)

// Calculate values
currentVol = volume
avgVol50 = ta.sma(volume, 50)

// Format as millions (M)
formatVolume(v) =>
v >= 1e9 ? str.tostring(v / 1e9, "#.##") + "B" :
v >= 1e6 ? str.tostring(v / 1e6, "#.##") + "M" :
v >= 1e3 ? str.tostring(v / 1e3, "#.##") + "K" :
str.tostring(v, "#.##")

// Create output strings
volText = "Current Volume: " + formatVolume(currentVol)
adtvText = "50-day ADTV: " + formatVolume(avgVol50)

// Display in a table
var table t = table.new(position.top_right, 1, 2, border_width = 1)
if bar_index % 5 == 0 // Update every 5 bars to avoid flicker
table.cell(t, 0, 0, adtvText, text_color=color.white, bgcolor=color.new(color.blue, 80))
table.cell(t, 0, 1, volText, text_color=color.white, bgcolor=color.new(color.blue, 80))

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.