OPEN-SOURCE SCRIPT
Ratio Between Two Symbols

Ratio Between Two Symbols — Plots the price ratio of the current chart's symbol against a user-selected benchmark (default: TVC:SPX / S&P 500 index), optionally scaled by a multiplier. A moving average (default length: 36) of the ratio is overlaid to smooth out trend direction. An optional floating label displays the current symbol pair, the live ratio value (truncated to a set number of digits), and the multiplier in use. This is typically used for relative strength/weakness analysis — e.g., is this asset outperforming or underperforming the benchmark over time — which is common in sector rotation, commodities-vs-equities, or intermarket analysis.
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.