OPEN-SOURCE SCRIPT
Asset Ratio [Chart-Based]

ASSET RATIO [CHART-BASED] — INDICATOR DESCRIPTION & METADATA
DESCRIPTION:
Asset Ratio is an institutional-grade relative strength indicator that compares
any two assets to identify mean reversion opportunities, breakouts, and regime
changes through statistical deviation analysis.
CORE FUNCTIONALITY:
• Compare any asset pair (stocks, crypto, commodities, indices, USD)
• Calculate Bollinger Band-style deviation bands around the ratio
• Z-score analysis identifies extreme overbought/oversold conditions
• Real-time correlation measurement between asset pair
• Percentage change tracking from benchmark date
KEY FEATURES:
✓ Four pre-built trading regimes (Long-Term, Bull-Run, Balanced, Custom)
✓ Dynamic Bollinger Bands with asymmetric deviation multipliers
✓ Institutional dashboard with Pairing, Deviation, Correlation, Verdict
✓ Mean reversion signal detection (crosses above lower band = bounce risk,
crosses below upper band = pullback risk)
✓ Performance tracking from custom start date with live percentage change label
✓ Comprehensive tooltips and input guidance for all parameters
✓ Aurelius-compliant color theme (dark mode optimized)
✓ Works on any timeframe with configurable smoothing and lookback periods
IDEAL FOR:
• Relative strength trading (tech vs financials, crypto vs traditional assets)
• Cross-asset momentum analysis
• Mean reversion strategies
• Pair trading and hedge construction
• Macro thematic investing
• Currency debasement monitoring (USD penalty mode)
The indicator excels at identifying when one asset is trading at statistical
extremes relative to a benchmark, signaling early entry and exit opportunities
before the ratio mean-reverts back to equilibrium.
CATEGORY:
Technical Analysis / Relative Strength / Multi-Asset Analysis
FEATURES SUMMARY:
Input Categories:
• Data Selection: Choose denominator asset, USD penalty, comparison mode
• Calibration: Select regime profile or customize all parameters
• Start Date: Benchmark for percentage change tracking
Outputs:
• Smoothed ratio with color-coded z-score status
• Upper/Lower Bollinger Bands with standard deviation multipliers
• Mean line with labeled endpoint
• Institutional dashboard (5-row table with real-time metrics)
• Percentage change label from start date
• Mean reversion signal documentation
Compatible Timeframes:
• 1-minute to Monthly (responsive on all timeframes)
Data Requirements:
• Chart asset: Any valid TradingView symbol
• Denominator asset: Any valid ticker (NASDAQ:QQQ, AMEX:GDX, COINBASE:BTCUSD, etc.)
• USD comparisons supported with configurable debasement penalty
USE CASES:
1. RELATIVE STRENGTH TRADING
Monitor when tech (QQQ) outperforms/underperforms financial stocks (XLF)
2. MACRO THEMATIC ANALYSIS
Track gold mining stocks (GDX) vs spot gold price for structural trades
3. PAIR TRADING
Identify when correlated pairs diverge for mean reversion entries
4. CURRENCY DEBASEMENT MONITORING
Compare commodity or asset prices to USD with penalty for inflation analysis
5. BREAKOUT CONFIRMATION
Use correlation and z-score to validate momentum breakouts in ratio pairs
6. MOMENTUM ANALYSIS
Identify which asset is gaining relative strength for directional trading
VERSION HISTORY:
v6.0 (Current)
• Comprehensive input tooltips with regime profile guidance
• Mean reversion signal documentation
• Data validation with runtime error handling
• Label at mean line endpoint
• Aurelius theme compliance with enhanced visibility
• Cross-asset correlation analysis
• Z-score extremes detection
• Institutional dashboard metrics
CREDITS:
Inspired by 'Market Hedge Ratio', created by Charles Edwards
© TrendMatrix_Labs
License: Mozilla Public License 2.0
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.