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
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.