OPEN-SOURCE SCRIPT

BTC Dashboard D / 4H / 1H (simple)

13
//version=5
indicator("BTC Dashboard D / 4H / 1H (simple)", overlay = true)

// ---------- Réglages ----------
rsiLen = 14
emaLen50 = 50
emaLen200 = 200

// Petite fonction pour formater les nombres
f_fmt(float v) =>
str.tostring(v, format.mintick)

// ---------- TIMEFRAMES ----------
tfD = "D"
tf4H = "240"
tf1H = "60"

// ---------- DAILY ----------
closeD = request.security(syminfo.tickerid, tfD, close)
ema50D = request.security(syminfo.tickerid, tfD, ta.ema(close, emaLen50))
ema200D = request.security(syminfo.tickerid, tfD, ta.ema(close, emaLen200))
rsiD = request.security(syminfo.tickerid, tfD, ta.rsi(close, rsiLen))

// ---------- 4H ----------
close4H = request.security(syminfo.tickerid, tf4H, close)
ema504H = request.security(syminfo.tickerid, tf4H, ta.ema(close, emaLen50))
ema2004H = request.security(syminfo.tickerid, tf4H, ta.ema(close, emaLen200))
rsi4H = request.security(syminfo.tickerid, tf4H, ta.rsi(close, rsiLen))

// ---------- 1H ----------
close1H = request.security(syminfo.tickerid, tf1H, close)
ema501H = request.security(syminfo.tickerid, tf1H, ta.ema(close, emaLen50))
ema2001H = request.security(syminfo.tickerid, tf1H, ta.ema(close, emaLen200))
rsi1H = request.security(syminfo.tickerid, tf1H, ta.rsi(close, rsiLen))

// ---------- TABLE ----------
var table t = table.new(position.top_right, 4, 4, border_width = 1)

if barstate.islast
// Ligne d’en-tête
table.cell(t, 0, 0, "TF", text_color = color.white, bgcolor = color.new(color.black, 0))
table.cell(t, 0, 1, "Close", text_color = color.white, bgcolor = color.new(color.black, 0))
table.cell(t, 0, 2, "EMA50 / EMA200", text_color = color.white, bgcolor = color.new(color.black, 0))
table.cell(t, 0, 3, "RSI", text_color = color.white, bgcolor = color.new(color.black, 0))

// ----- DAILY -----
rowD = 1
table.cell(t, rowD, 0, "D", text_color = color.yellow, bgcolor = color.new(color.blue, 70))
table.cell(t, rowD, 1, f_fmt(closeD))
table.cell(t, rowD, 2, "50: " + f_fmt(ema50D) + "\n200: " + f_fmt(ema200D))
table.cell(t, rowD, 3, f_fmt(rsiD))

// ----- 4H -----
row4 = 2
table.cell(t, row4, 0, "4H", text_color = color.white, bgcolor = color.new(color.teal, 70))
table.cell(t, row4, 1, f_fmt(close4H))
table.cell(t, row4, 2, "50: " + f_fmt(ema504H) + "\n200: " + f_fmt(ema2004H))
table.cell(t, row4, 3, f_fmt(rsi4H))

// ----- 1H -----
row1 = 3
table.cell(t, row1, 0, "1H", text_color = color.white, bgcolor = color.new(color.green, 70))
table.cell(t, row1, 1, f_fmt(close1H))
table.cell(t, row1, 2, "50: " + f_fmt(ema501H) + "\n200: " + f_fmt(ema2001H))
table.cell(t, row1, 3, f_fmt(rsi1H))

Disclaimer

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.