OPEN-SOURCE SCRIPT
Relative Performance Analyzer [AstrideUnicorn]

Relative Performance Analyzer (RPA) is a performance analysis tool inspired by the data comparison features found in professional trading terminals. The RPA replicates the analytical approach used by portfolio managers and institutional analysts who routinely compare multiple securities or other types of data to identify relative strength opportunities, make allocation decisions, choose the most optimal investment from several alternatives, and much more.
Key Features:
Practical Use Cases:
Example Scenarios:
HOW DOES IT WORK
The indicator calculates and visualizes performance from a user-defined starting point using two methodologies:
HOW TO USE
SETTINGS
Assets 1-5: Toggle on/off and input symbols for comparison (stocks, ETFs, indices, forex, crypto, fundamental data, etc.)
Start Date: Set the initial point for return calculations (drag on chart or input manually)
Return Type: Choose between "Percentage" or "Risk-Adjusted" performance.
Key Features:
- Multi-Symbol Comparison: Track up to 5 different symbols simultaneously across any asset class or dataset
- Two Performance Calculation Methods: Choose between percentage returns or risk-adjusted returns
- Interactive Analysis: Drag the start date line on the chart or manually choose the start date in the settings
- Professional Visualization: High-contrast color scheme designed for both dark and light chart themes
- Live Performance Table: Real-time display of current return values sorted from the top to the worst performers
Practical Use Cases:
- ETF Selection: Compare similar ETFs (e.g., SPY vs IVV vs VOO) to identify the most efficient investment
- Sector Rotation: Analyze which sectors are showing relative strength for strategic allocation
- Competitive Analysis: Compare companies within the same industry to identify leaders (e.g., APPLE vs SAMSUNG vs XIAOMI)
- Cross-Asset Allocation: Evaluate performance across stocks, bonds, commodities, and currencies to guide portfolio rebalancing
- Risk-Adjusted Decisions: Use risk-adjusted performance to find investments with the best returns per unit of risk
Example Scenarios:
- Analyze whether tech stocks are outperforming the broader market by comparing XLK to SPY
- Evaluate which emerging market ETF (EEM vs VWO) has provided better risk-adjusted returns over the past year
HOW DOES IT WORK
The indicator calculates and visualizes performance from a user-defined starting point using two methodologies:
- Percentage Returns: Standard total return calculation showing percentage change from the start date
- Risk-Adjusted Returns: Cumulative returns divided by the volatility (standard deviation), providing insight into the efficiency of performance. An expanding window is used to calculate the volatility, ensuring accurate risk-adjusted comparisons throughout the analysis period.
HOW TO USE
- Setup Your Comparison: Enable up to 5 assets and input their symbols in the settings
- Set Analysis Period: When you first launch the indicator, select the start date by clicking on the price chart. The vertical start date line will appear. Drag it on the chart or manually input a specific date to change the start date.
- Choose Return Type: Select between percentage or risk-adjusted returns based on your analysis needs
- Interpret Results
- Use the real-time table for precise current values
SETTINGS
Assets 1-5: Toggle on/off and input symbols for comparison (stocks, ETFs, indices, forex, crypto, fundamental data, etc.)
Start Date: Set the initial point for return calculations (drag on chart or input manually)
Return Type: Choose between "Percentage" or "Risk-Adjusted" performance.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
Our premium trading indicators: unicorn.trading
Join our Discord community: dsc.gg/unicom
Join our Discord community: dsc.gg/unicom
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
Our premium trading indicators: unicorn.trading
Join our Discord community: dsc.gg/unicom
Join our Discord community: dsc.gg/unicom
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。