INVITE-ONLY SCRIPT

RiskON/RiskOff Ratio Combined

70
RiskON/RiskOff Ratio Combined Indicator

This indicator provides a comprehensive view of market risk appetite by analyzing the ratio between a proprietary risk-on asset and a risk-off benchmark. It helps traders identify shifts in market sentiment, potential bullish or bearish momentum, and correlations with key assets like Bitcoin, all while adapting to different timeframes for reliable signals.

How It Works
The core of the indicator is a dynamic ratio calculated from selected market proxies. This ratio is smoothed using an adaptive moving average that adjusts its length based on the chosen timeframe or a fixed resolution mode, ensuring consistency across charts and handling gaps during market closures. The difference between the raw ratio and its moving average is normalized to a scale between -1 and 1, allowing for clear interpretation of market strength.
  • Normalization uses a lookback period to scale deviations dynamically, preventing extreme values from skewing readings.
  • Signals are generated based on confirmed crosses or momentum shifts, with options for fixed-resolution confirmation to avoid false positives during intraday volatility.

Additionally, it incorporates Bitcoin correlation analysis against a user-selected reference (S&P 500 or Nasdaq 100 proxy) and gold, using daily returns over a customizable period. This helps detect decorrelation periods where the indicator's reliability might be affected, with color-coded warnings.

Inputs
  • Use Fixed Resolution: Enable to use a consistent calculation timeframe (default: Daily) with gap handling for accuracy; disable for current chart timeframe.
  • Calculation Resolution: Timeframe for fixed mode (e.g., 'D' for daily).
  • Base MA Length: Starting length for the adaptive moving average (default: around 185 periods, adjustable).
  • Max MA Length: Upper limit for adaptation (default: high value to prevent overflow).
  • Use Color Gradient: Toggle between gradient colors (for nuanced sentiment) or simple bull/bear colors.
  • Show BTC Correlation: Display correlation metrics (default: enabled).
  • Bitcoin Ticker: Symbol for BTC (default: INDEX:BTCUSD).
  • Reference Asset: Choose between SPY (S&P 500) or QQQ (Nasdaq 100) for correlation.
  • Correlation Period: Days for calculation (default: 50).
  • Warning Threshold: Level for decorrelation alerts (default: 0.3).


Outputs and Display
  • Plots: The ratio line (colored based on direction), its adaptive moving average, and a fill area highlighting the normalized difference with gradient or signal-based colors.
  • Market State Table: Displays current sentiment as "STRONG BUY", "BUY", "NEUTRAL", "SELL", or "STRONG SELL" with thresholds, plus mode info and optional BTC correlations (with status like "RELIABLE", "CAUTION", "DECORR", or "INVERSE").
  • Alerts: Conditions for bullish/bearish signals and decorrelation warnings.


Usage
Add the indicator to any chart (e.g., major indices or crypto). Use it to gauge risk-on/off environments: positive normalized values suggest buying momentum, negative indicate selling pressure. Monitor correlations for Bitcoin-related strategies—low correlation may signal regime changes. Best on daily or higher timeframes for stability. Combine with other tools for confirmation.

Originality
This indicator uniquely combines a risk ratio with timeframe-adaptive smoothing, dynamic normalization, and integrated correlation checks, providing a multi-faceted risk assessment not found in standard tools. It evolves from traditional risk metrics by incorporating gap handling and confirmation logic for robustness across markets.

For invite-only access: Please contact me via TradingView private message with your use case to request an invitation. Access is granted selectively.

Notes
Past performance is not indicative of future results. This is not investment advice—use at your own risk.

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。