OPEN-SOURCE SCRIPT

Forza Relativa - Professional Table v2

138
█ OVERVIEW
Questo indicatore calcola e mostra la Forza Relativa (Relative Strength) di un asset rispetto a un benchmark di riferimento e al suo settore di appartenenza (se applicabile). Tutti i calcoli sono basati su giorni solari reali ("Calendar Days"), garantendo un confronto preciso e uniforme delle performance su diversi archi temporali: 1g, 7g, 30g, 60g, 90g e 180g.

A differenza delle tabelle standard, questa versione è stata interamente ottimizzata per il Tema Scuro (Dark Theme) di TradingView, garantendo una leggibilità nitida e professionale in ogni condizione di mercato.


█ CARATTERISTICHE PRINCIPALI
• Adattabilità Asset & Crypto: Lo script rileva automaticamente la classe di asset sul grafico. Se l'asset è una Criptovaluta, imposta come benchmark predefinito Bitcoin (BTC) o Ethereum (ETH) a scelta dell'utente. Se l'asset è un'Azione o ETF, utilizza lo S&P500 (SPY) come benchmark e attiva la colonna dedicata al "Settore".
• Selezione del Settore: Per il mercato azionario, è possibile selezionare manualmente l'ETF settoriale di riferimento (es. XLK per il Tech, XLF per i Finanziari, ecc.) per monitorare se l'asset sta sovraperformando o sottoperformando il proprio settore di appartenenza.
• Calcolo a Giorni Solari (Calendar Days): Le variazioni percentuali non si basano sul semplice conteggio delle candele del grafico corrente (che variano a seconda del timeframe), ma calcolano l'effettiva variazione temporale indietro nel tempo, rendendo l'indicatore ideale sia su grafici Daily che Intraday.


█ OTTIMIZZAZIONE GRAFICA & NITIDEZZA (DARK THEME)
Per risolvere il classico problema di scarsa leggibilità delle tabelle TradingView su sfondi scuri, sono state introdotte le seguenti migliorie:
1. Contrasto Dinamico: Il testo delle celle utilizza una palette di colori e trasparenze che si adatta allo sfondo per risaltare chiaramente senza affaticare la vista.
2. Palette Colori Soft: Sostituiti i verdi e rossi standard (troppo accesi e fastidiosi su sfondo scuro) con un elegante Verde Smeraldo Soft per i rendimenti positivi e un Rosso Corallo Soft per quelli negativi.
3. Griglia Protetta: La tabella presenta bordi grigio-scuri solidi per separare nettamente i dati e le colonne, rendendo l'interfaccia pulita e moderna.


█ PARAMETRI PERSONALIZZABILI (INPUTS)
• Crypto Benchmark: Consente di scegliere tra BTCUSDT ed ETHUSDT quando si analizzano le criptovalute.
• Dimensione Testo Tabella: Modifica la dimensione della tabella per adattarla a schermi di diverse risoluzioni (Tiny, Small, Normal, Large, Huge).
• Posizione Tabella: Permette di posizionare la griglia in qualsiasi angolo del grafico (es. in basso a destra, in alto a sinistra, ecc.) per non coprire i prezzi.
• Settore Manuale: Consente di selezionare l'ETF settoriale SPDR di riferimento per l'asset azionario sotto analisi.


█ NOTE SUL TIMEFRAME
Dato che l'indicatore analizza performance storiche fino a 180 giorni solari fa, si consiglia di utilizzare timeframe come il Giornaliero (1D) o l'Orario (1H/4H). Su timeframe estremamente ridotti (es. 1 o 5 minuti), TradingView potrebbe non avere abbastanza candele storiche caricate per calcolare i periodi più lunghi, mostrando la dicitura "n/a" (non disponibile).

Relative Strength vs Benchmark & Sector (Dark Theme)
█ OVERVIEW
This indicator measures and displays the Relative Strength (RS) of an asset by comparing its performance against a selected benchmark and, when applicable, its sector benchmark.
All calculations are based on actual Calendar Days rather than a simple bar count, ensuring consistent and accurate performance comparisons across the following periods:
1D, 7D, 30D, 60D, 90D, and 180D
The table has been specifically designed and optimized for the TradingView Dark Theme, providing maximum readability, strong contrast, and a professional appearance under all market conditions.

█ KEY FEATURES
• Automatic Asset Detection
The script automatically identifies the type of asset displayed on the chart:

Cryptocurrencies: uses either Bitcoin (BTC) or Ethereum (ETH) as the benchmark, selectable by the user.
Stocks and ETFs: uses SPY (S&P 500 ETF) as the benchmark and automatically enables the Sector comparison column.

• Sector Comparison
For equities, users can manually select the appropriate SPDR sector ETF (XLK, XLF, XLE, XLV, etc.) to determine whether the stock is:

Outperforming its sector
Underperforming its sector
Moving in line with its sector

• Calendar-Day Performance Calculation
Performance measurements are independent of the chart timeframe.
Instead of relying on the number of bars displayed, percentage changes are calculated using actual calendar days, ensuring consistent results across both Daily and Intraday charts.

█ DARK THEME VISUAL OPTIMIZATION
To improve readability on dark backgrounds, several visual enhancements have been implemented:
1. Dynamic Contrast
Text colors and transparency levels have been carefully tuned to provide excellent visibility while minimizing eye strain.
2. Soft Color Palette
Standard colors have been replaced with more balanced tones:

Soft Emerald Green for positive values
Soft Coral Red for negative values

This creates a cleaner appearance and improves readability during extended analysis sessions.
3. High-Definition Grid
The table uses solid dark-gray borders to clearly separate cells, columns, and headers, resulting in a modern and professional layout.

█ CUSTOMIZABLE INPUTS
• Crypto Benchmark
Select the benchmark used for cryptocurrency analysis:

BTCUSDT
ETHUSDT

• Table Text Size
Adjust the table size to fit different screen resolutions:

Tiny
Small
Normal
Large
Huge

• Table Position
Place the table anywhere on the chart:

Top Left
Top Right
Bottom Left
Bottom Right

• Manual Sector Selection
Choose the SPDR sector ETF used as the sector benchmark for relative performance analysis.

█ DATA INTERPRETATION
Positive values indicate that the asset is outperforming its benchmark or sector.
Negative values indicate underperformance, signaling weaker relative strength compared to the benchmark or sector being analyzed.

█ TIMEFRAME NOTES
Since the indicator analyzes historical performance up to 180 calendar days, the following timeframes are recommended:

1D
4H
1H

On very low timeframes (such as 1-minute or 5-minute charts), TradingView may not have enough historical bars loaded to calculate the longest lookback periods. In these cases, some cells may display "n/a" (data not available).

Ideal for quickly identifying assets that are demonstrating superior relative strength versus both the broader market and their respective sector, regardless of the chart timeframe being used.

Thông báo miễn trừ trách nhiệm

Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.