OPEN-SOURCE SCRIPT

TSEP Dual SMA + Optional BB

33
//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))

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.