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提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。