Codice Sorgente : // ============================================================

// NQ Sessione NY — 8 EMA / 13·21·55 Cruscotto TEMA

// Versione: v3.0

//

// Caratteristiche:

// — 8 EMA (blu, spesso) + 13/21/55 linee TEMA

// — VWAP

// — Tabella di controllo (in alto a destra):

// ✔/✘ 8 EMA incrociato 55 TEMA

// ▲/▼ Direzione del trend (rialzista/ribassista)

// ✔/✘ Allineamento 55 TEMA (sopra tutti per corto / sotto tutti per lungo)

// ✔/✘ Il timeframe di 5m concorda (8 EMA vs 55 TEMA su 5m)

// ============================================================

//@version=6

indicator(title = "NQ NY — Dashboard EMA/TEMA",

shorttitle = "EMA/TEMA Dash",

overlay = true,

max_labels_count = 500,

max_boxes_count = 100)

// ─────────────────────────────────────────────

// INPUTS

// ─────────────────────────────────────────────

grpEma = "Medie Mobili"

emaLen = input.int(8, "Lunghezza EMA", minval=1, group=grpEma)

t13Len = input.int(13, "Lunghezza TEMA 13", minval=1, group=grpEma)

t21Len = input.int(21, "Lunghezza TEMA 21", minval=1, group=grpEma)

t55Len = input.int(55, "Lunghezza TEMA 55", minval=1, group=grpEma)

showT13 = input.bool(true, "Mostra 13 TEMA", group=grpEma)

showT21 = input.bool(true, "Mostra 21 TEMA", group=grpEma)

showVwap = input.bool(true, "Mostra VWAP", group=grpEma)

grpVis = "Visivi"

emaCol = input.color(#1E90FF, "Colore EMA 8", group=grpVis)

t13Col = input.color(color.new(#B39DDB,0),"Colore TEMA 13", group=grpVis)

t21Col = input.color(color.new(#FFD740,0),"Colore TEMA 21", group=grpVis)

t55Col = input.color(color.new(#FF9800,0),"Colore TEMA 55", group=grpVis)

vwapCol = input.color(color.new(#E040FB,0),"Colore VWAP", group=grpVis)

// ─────────────────────────────────────────────

// CALCOLI DELLA MEDIA MOBILE

// ─────────────────────────────────────────────

tema(src, len) =>

e1 = ta.ema(src, len)

e2 = ta.ema(e1, len)

e3 = ta.ema(e2, len)

3 e1 - 3 e2 + e3

ema8 = ta.ema(close, emaLen)

t13 = tema(close, t13Len)

t21 = tema(close, t21Len)

t55 = tema(close, t55Len)

// VWAP (sessione)

[vwapVal, , ] = ta.vwap(hlc3, false, 1)

// ─────────────────────────────────────────────

// LOGICA CHECKLIST

// ─────────────────────────────────────────────

// 1. Ha 8 EMA incrociato 55 TEMA? (è attualmente da un lato)

// Verde = un incrocio è avvenuto (ema8 != t55 side, cioè non sono uguali/intrecciati)

// Monitoriamo se ema8 è sopra o sotto t55 come stato di incrocio

emaCrossedBull = ema8 > t55 // ema incrociato sopra → rialzista

emaCrossedBear = ema8 < t55 // ema incrociato sotto → ribassista

crossOccurred = emaCrossedBull or emaCrossedBear

// 2. Direzione del trend

isBullish = ema8 > t55

isBearish = ema8 < t55

// 3. Allineamento TEMA 55

// Per CORTO: t55 dovrebbe essere SOPRA a tutte le altre MA (prezzo sotto tutte = stack ribassista)

// Per LUNGO: t55 dovrebbe essere SOTTO a tutte le altre MA (prezzo sopra tutte = stack rialzista)

t55AboveAll = t55 > ema8 and t55 > t13 and t55 > t21 // buono per CORTO

t55BelowAll = t55 < ema8 and t55 < t13 and t55 < t21 // buono per LUNGO

t55Aligned = t55AboveAll or t55BelowAll

// 4. Allineamento del timeframe di 5 minuti (8 EMA vs 55 TEMA su 5m)

ema8_5m = request.security(syminfo.tickerid, "5", ta.ema(close, 8), lookahead=barmerge.lookahead_off)

t55_5m_e1 = request.security(syminfo.tickerid, "5", ta.ema(close, 55), lookahead=barmerge.lookahead_off)

t55_5m_e2 = request.security(syminfo.tickerid, "5", ta.ema(t55_5m_e1, 55), lookahead=barmerge.lookahead_off)

t55_5m_e3 = request.security(syminfo.tickerid, "5", ta.ema(t55_5m_e2, 55), lookahead=barmerge.lookahead_off)

t55_5m = 3 t55_5m_e1 - 3 t55_5m_e2 + t55_5m_e3

tfAlignBull = ema8_5m > t55_5m // 5m rialzista concorda con il rialzista attuale

tfAlignBear = ema8_5m < t55_5m // 5m ribassista concorda con il ribassista attuale

tfAligned = (isBullish and tfAlignBull) or (isBearish and tfAlignBear)

// ─────────────────────────────────────────────

// RILEVAZIONE INCROCI

// ─────────────────────────────────────────────

bullCross = ta.crossover(ema8, t55)

bearCross = ta.crossunder(ema8, t55)

// ─────────────────────────────────────────────

// PLOTS

// ─────────────────────────────────────────────

plot(t55, title="55 TEMA", color=t55Col, linewidth=2)

plot(showT21 ? t21 : na, title="21 TEMA", color=t21Col, linewidth=2)

plot(showT13 ? t13 : na, title="13 TEMA", color=t13Col, linewidth=1)

plot(ema8, title="8 EMA", color=emaCol, linewidth=4)

plot(showVwap ? vwapVal : na, title="VWAP", color=vwapCol, linewidth=1, style=plot.style_circles)

// Marcatori di incrocio — "+" etichetta posizionata all'esatto incrocio di 8 EMA e 55 TEMA

crossPrice = math.avg(ema8, t55)

if bullCross

label.new(bar_index, crossPrice,

text = "+",

textcolor = #00E676,

style = label.style_none,

size = size.huge)

if bearCross

label.new(bar_index, crossPrice,

text = "+",

textcolor = #FF1744,

style = label.style_none,

size = size.huge)

// ─────────────────────────────────────────────

// TABELLA DASHBOARD

// ─────────────────────────────────────────────

var table dash = table.new(

position = position.top_right,

columns = 2,

rows = 6,

bgcolor = color.new(#0D1117, 10),

border_width = 1,

border_color = color.new(#2A3A4A, 0),

frame_width = 2,

frame_color = color.new(#1E90FF, 60))

// Colori

C_GREEN = #00E676

C_RED = #FF1744

C_WHITE = #EAEAEA

C_MUTED = #607080

C_HEADER = #0D1117

C_BULL = #00E676

C_BEAR = #FF1744

if barstate.islast

// ── Intestazione ──────────────────────────────

table.cell(dash, 0, 0, "CONDIZIONE",

text_color=color.new(C_MUTED, 0),

text_size=size.small,

bgcolor=color.new(#141C27, 0),

text_halign=text.align_left)

table.cell(dash, 1, 0, "STATO",

text_color=color.new(C_MUTED, 0),

text_size=size.small,

bgcolor=color.new(#141C27, 0),

text_halign=text.align_center)

// ── Riga 1: Incrocio ────────────────────

table.cell(dash, 0, 1, "EMA8 × TEMA55 Incrocio",

text_color=C_WHITE,

text_size=size.small,

bgcolor=color.new(#0D1117, 0),

text_halign=text.align_left)

table.cell(dash, 1, 1,

crossOccurred ? "✔" : "✘",

text_color = crossOccurred ? C_GREEN : C_RED,

text_size = size.normal,

bgcolor = color.new(#0D1117, 0),

text_halign= text.align_center)

// ── Riga 2: Direzione del Trend ───────────────

trendTxt = isBullish ? "▲ RIALZISTA" : isBearish ? "▼ RIBASSISTA" : "─ NEUTRALE"

trendColor = isBullish ? C_BULL : isBearish ? C_BEAR : C_MUTED

table.cell(dash, 0, 2, "Direzione del Trend",

text_color=C_WHITE,

text_size=size.small,

bgcolor=color.new(#0D1117, 0),

text_halign=text.align_left)

table.cell(dash, 1, 2, trendTxt,

text_color = trendColor,

text_size = size.small,

bgcolor = color.new(#0D1117, 0),

text_halign= text.align_center)

// ── Riga 3: Allineamento Stack TEMA 55 ───────

// Mostra per cosa è allineato (lungo o corto), o ✘ se nessuno

stackTxt = t55BelowAll ? "✔ LUNGO" :

t55AboveAll ? "✔ CORTO" : "✘"

stackColor = t55Aligned ? C_GREEN : C_RED

table.cell(dash, 0, 3, "TEMA55 Stack Allineato",

text_color=C_WHITE,

text_size=size.small,

bgcolor=color.new(#0D1117, 0),

text_halign=text.align_left)

table.cell(dash, 1, 3, stackTxt,

text_color = stackColor,

text_size = size.small,

bgcolor = color.new(#0D1117, 0),

text_halign= text.align_center)

// ── Riga 4: Allineamento TF 5m ───────────────

tfTxt = tfAligned ? "✔ ACCORDO" : "✘ CONFLITTI"

tfColor = tfAligned ? C_GREEN : C_RED

table.cell(dash, 0, 4, "TF 5m Allineato",

text_color=C_WHITE,

text_size=size.small,

bgcolor=color.new(#0D1117, 0),

text_halign=text.align_left)

table.cell(dash, 1, 4, tfTxt,

text_color = tfColor,

text_size = size.small,

bgcolor = color.new(#0D1117, 0),

text_halign= text.align_center)

// ── Riga 5: Riepilogo Tutto Verde ─────────────

allGreen = crossOccurred and t55Aligned and tfAligned

summaryTxt = allGreen ? "● CONFLUENTE" : "● ASPETTA"

summaryCol = allGreen ? C_GREEN : C_MUTED

table.cell(dash, 0, 5, "Confluenza",

text_color = C_MUTED,

text_size = size.small,

bgcolor = color.new(#141C27, 0),

text_halign= text.align_left)

table.cell(dash, 1, 5, summaryTxt,

text_color = summaryCol,

text_size = size.small,

bgcolor = color.new(#141C27, 0),

text_halign= text.align_center)

$BTC #BTC #ETH🔥🔥🔥🔥🔥🔥