OPEN-SOURCE SCRIPT
Ratio Between Two Symbols

This indicator calculates and displays the price ratio between two symbols, allowing you to compare relative performance and strength.
The chart shows the current symbol divided by a benchmark symbol (default: S&P 500), with an optional multiplier to scale the ratio for easier visualization. A moving average (default 20-period SMA) smooths the ratio to identify trends in relative performance.
When the ratio is rising, the current symbol is outperforming the benchmark. When falling, it's underperforming. The moving average helps identify the overall trend direction and potential reversals in relative strength.
Features:
- Compare any two symbols in real-time
- Adjustable moving average period
- Customizable ratio multiplier for scaling
- Optional label showing current ratio value
- Adjustable decimal precision
Useful for:
- Relative strength analysis
- Pair trading opportunities
- Sector/stock rotation strategies
- Comparing asset class performance
The chart shows the current symbol divided by a benchmark symbol (default: S&P 500), with an optional multiplier to scale the ratio for easier visualization. A moving average (default 20-period SMA) smooths the ratio to identify trends in relative performance.
When the ratio is rising, the current symbol is outperforming the benchmark. When falling, it's underperforming. The moving average helps identify the overall trend direction and potential reversals in relative strength.
Features:
- Compare any two symbols in real-time
- Adjustable moving average period
- Customizable ratio multiplier for scaling
- Optional label showing current ratio value
- Adjustable decimal precision
Useful for:
- Relative strength analysis
- Pair trading opportunities
- Sector/stock rotation strategies
- Comparing asset class performance
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que la republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que la republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.