Stock vs SPY % Change

This Pine Script indicator helps you compare a stock's price performance to the S&P 500 (using SPY ETF) over a user-defined period. It calculates the percentage price change of the stock and SPY, then displays the difference as a relative performance metric. A positive value (plotted in green) indicates the stock is outperforming SPY (e.g., dropping only 3% while SPY drops 10%), while a negative value (plotted in red) shows underperformance.
Features:
Adjustable lookback period (default: 20 days) to analyze recent performance.
Visual plot with green/red coloring for quick interpretation.
Zero line to clearly separate outperformance from underperformance.
How to Use:
Apply the indicator to your stock's chart.
Set the "Lookback Period" in the settings (e.g., 20 for ~1 month).
Check the plot:
Green (above 0) = Stock's % change is better than SPY's.
Red (below 0) = Stock's % change is worse than SPY's.
Use on daily or weekly charts for best results.
Ideal for identifying stocks that hold up better during market downturns or outperform in uptrends. Perfect for relative strength analysis and to spot accumulation.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.
Declinazione di responsabilità
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.