PROTECTED SOURCE SCRIPT
Aggiornato

Quantum Yield Matrix

126
Quantum Yield Matrix is a sophisticated Pine Script™ v6 indicator designed to empower traders with a dynamic visualization of compound returns across global markets. It generates a customizable table showcasing daily percentage changes, cumulative compound returns, and performance differentials for a user-selected index and up to 10 stocks within a defined date range. The table automatically updates when the date range is modified, ensuring seamless flexibility for analysis. Ideal for portfolio evaluation, benchmark comparisons, and multi-exchange tracking, this tool operates independently of external data sources.

Key Features
Multi-Exchange Support: Integrates data from major exchanges, including BIST (Turkey), NYSE and NASDAQ (USA), SSE (China Shanghai Composite), XETR (Germany DAX), NSE (India NIFTY), and TVC (Japan Nikkei and other indices). Users select a single exchange per analysis, with automatic prefixing for accurate symbol resolution (e.g., NASDAQ:NDX).
Performance Metrics: Computes daily returns ((close - previous close) / previous close), aggregates compound returns over the period, and provides:Total return percentages.
Stock-versus-index performance differences (e.g., alpha insights).
A bottom summary comparing the watchlist’s average return to the index.

Visual Table Design: Features a color-coded table (green for positive returns, red for negative, gray for totals) with date headers for intuitive readability. Missing data is elegantly handled with "No Data" in gray cells, ensuring robust calculations.

Dynamic Customization: Allows full adjustment of exchange, index symbol (e.g., NDX for NASDAQ), stock symbols (e.g., AAPL, TSLA), and date range. The table dynamically recalculates when the date range changes, making it perfect for backtesting or forward-looking analysis.

Purpose and BenefitsQuantum Yield Matrix delivers a quantum leap in yield analysis by organizing complex return data into a clear, matrix-like table. It simplifies portfolio performance evaluation against benchmarks, highlighting outperforming assets at a glance. Whether assessing a NASDAQ tech portfolio against NDX or exploring emerging market stocks, this tool saves time, enhances decision-making, and fosters cross-market awareness for diversified strategies in today’s interconnected global economy.

How It Works
Setup: In the indicator settings, select an exchange (default: NASDAQ), input the index symbol (e.g., NDX), and up to 10 stock symbols (defaults: AAPL, TSLA, MSFT, etc.). Define the analysis period with start and end dates. Adjusting the date range instantly updates the table.
Data Retrieval: Leverages TradingView’s request.security function to fetch daily closing prices for each symbol, respecting the chosen exchange prefix (e.g., "NASDAQ:NDX").

Calculations:Daily returns are calculated as percentage changes.
Compound returns accumulate multiplicatively (starting from 1.0, multiplied by (1 + daily return)).
Comparisons subtract index returns from each stock’s total, with averages summarized at the bottom.

Rendering: Constructs a detailed table at the top-center of the chart and a summary table at the bottom. The script aligns with the chart’s timeframe but aggregates data to daily ("D") for consistency.

Edge Cases: If data is unavailable (e.g., due to exchange-specific holidays), cells display "No Data," preserving the integrity of compound return calculations.

Important Usage Note: For optimal results, set your chart symbol to match the analyzed exchange, such as NASDAQ:NDX for US data. The indicator relies on the chart’s bars, so mismatched symbols (e.g., a BIST symbol for US data) may skip non-trading days (e.g., July 15, a Turkish holiday).
Use daily or higher timeframes for best performance.

Disclaimer
This indicator is provided for educational and informational purposes only and does not constitute financial, investment, or trading advice. Past performance is not indicative of future results, and all trading involves risk of loss. Users are solely responsible for their decisions. The script is original, uses only built-in Pine Script functions, and complies with TradingView’s publishing rules—no external libraries, exaggerated claims, or guarantees are implied. Always verify data accuracy and consult professionals before acting on insights.

Feedback is welcome—feel free to fork and enhance!

Note di rilascio
Update Description for 'Quantum Yield Matrix - Multi Exchange'

Version Update: Enhanced Multi-Exchange Support and Customization (August 13, 2025)
This update builds upon the original 'Quantum Yield Matrix' indicator to provide greater flexibility, usability, and analytical depth for traders monitoring stock and index performance across multiple exchanges.
The core functionality—calculating daily compounded returns, displaying them in a color-coded table, and comparing stocks against benchmarks—remains intact, but several key improvements have been implemented based on user feedback and to support more diverse market analysis.

Key Enhancements:

Multi-Exchange Compatibility:Removed the single-exchange limitation (previously selected via a dropdown like 'NASDAQ', 'NYSE', etc.).

Symbols are now inputted directly with their exchange prefixes (e.g., 'NASDAQ:NDX' for the Nasdaq-100 index, 'NYSE:NYA' for the NYSE Composite, 'NASDAQ:AAPL' for Apple stock, or 'NYSE:IBM' for IBM). This allows mixing symbols from different exchanges in one indicator, enabling cross-market comparisons without normalization hacks.

The normalizeSymbol function has been eliminated, simplifying the code and reducing potential errors.

Dual Index Support:Expanded from one index to two customizable indices (e.g., NASDAQ:NDX and NYSE:NYA by default).

Added dedicated "vs Index1" and "vs Index2" columns in the main table for direct performance comparisons of each stock against both indices.

The bottom summary table now calculates the average return of the two indices and compares the watchlist average against this combined benchmark, providing a more balanced overview.

User-Adjustable Color Palette:All colors (headers, dates, positive/negative returns, backgrounds, etc.) are now configurable via input.color options in the settings panel.
This allows users to personalize the visual theme for better readability, accessibility (e.g., high-contrast modes), or branding. Previously, colors were hardcoded and non-editable.

Improved Table Layout and Readability:Integrated stock-vs-index comparisons directly into the main table as additional columns (after the "Total Return" column), replacing the previous separate rows at the bottom.
This creates a more cohesive and scroll-friendly view.
Symbol names in the table now include exchange prefixes for clarity (e.g., 'NASDAQ:AAPL' instead of just 'AAPL').
Enhanced handling of "No Data" cells with a dedicated color, and cleaned up cell rendering for consistency.
The bottom table has been expanded to 4 columns to accommodate the dual-index averages.

Code Optimizations and Cleanup:Streamlined the calculatePerformance function by removing redundant assignments and returns, improving efficiency.
Reduced overall code complexity while maintaining full functionality—no breaking changes for existing setups.
Updated default stock examples to include mixed exchanges (e.g., added NYSE symbols like IBM, JPM, KO) to demonstrate multi-exchange usage.

How to Use the Updated Indicator:

Settings Panel: Adjust start/end dates, enter symbols with prefixes, and customize colors as needed.

Date Range: Defaults to July 14–26, 2025, for testing; change to your preferred period.

Output: The main table shows daily returns, totals, and vs comparisons.
The bottom table summarizes watchlist vs. index performance.

Compatibility: Works on daily timeframes ('D') with security requests. Ensure symbols are valid for your exchange.

This update makes the indicator more versatile for global traders, especially those tracking tech-heavy Nasdaq stocks alongside traditional NYSE names. If you encounter issues or have suggestions, feel free to comment below. Happy trading!

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.