OPEN-SOURCE SCRIPT

Relative Performance Analyzer [AstrideUnicorn]

26
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:
  • 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:
  1. Analyze whether tech stocks are outperforming the broader market by comparing XLK to SPY cuplikan
  2. Evaluate which emerging market ETF (EEM vs VWO) has provided better risk-adjusted returns over the past year cuplikan



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
  1. Setup Your Comparison: Enable up to 5 assets and input their symbols in the settings
  2. 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.
  3. Choose Return Type: Select between percentage or risk-adjusted returns based on your analysis needs
  4. Interpret Results
  5. 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.

Pernyataan Penyangkalan

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.