1. Inputs and Data Sources The script pulls data for the following financial metrics using TradingView's request.security function:
CBOE:VIX (Volatility Index): A measure of market volatility. MOVE Index: A measure of bond market volatility (or Treasury volatility). BAMLH0A0HYM2 (High-Yield Spread): The spread between high-yield corporate bonds and Treasury yields. BAMLC0A0CM (Credit Spread): The spread for investment-grade corporate bonds. Each of these metrics represents a key aspect of financial conditions:
VIX: Equity market risk. MOVE: Bond market risk. High-Yield Spread and Credit Spread: Perception of risk in corporate debt.
2. Z-Score Calculation A z-score standardizes each metric to show how far it deviates from its average over a specified period (lookback = 160, or 160 days):
Positive z-scores indicate the metric is higher than average. Negative z-scores indicate the metric is lower than average. The formula for the z-score:
Z-Score = Metric − Mean Standard Deviation Z-Score = Standard Deviation Metric−Mean
3. Combined Z-Score The script combines the four individual z-scores into a single Composite Z-Score, equally weighted across the metrics:
Combined Z-Score = (Z VIX + Z MOVE + Z High-Yield Spread + Z Credit Spread) / 4 This Combined Z-Score provides an overall measure of financial conditions:
Positive combined z-scores indicate tighter or riskier financial conditions. Negative combined z-scores indicate looser or less risky financial conditions.
4. Visual Elements on the Chart A. Colorful Lines: Individual Z-Scores Each of the four metrics is plotted as a separate line:
Red: Z-score of the VIX. Green: Z-score of the MOVE index. Orange: Z-score of the high-yield spread. Purple: Z-score of the credit spread. These lines show how each metric contributes to the overall financial conditions. For example:
A rising red line means increasing equity market volatility (risk). A rising green line means increasing bond market volatility (risk). B. Blue Line: Combined Z-Score The blue line represents the Combined Z-Score. It aggregates the individual z-scores into a single measure:
A rising blue line suggests financial conditions are tightening (greater risk across markets). A falling blue line suggests financial conditions are loosening (lower risk across markets). C. Red and Green Background: Z-Score Regions Red Background: When the Combined Z-Score is positive (>0), it indicates riskier or tighter financial conditions. Green Background: When the Combined Z-Score is negative (<0), it indicates less risky or looser financial conditions. This background coloring helps visually distinguish periods of riskier financial conditions from less risky ones.
5. Purpose of the Visualization This indicator provides a comprehensive view of financial conditions across multiple asset classes:
Traders can use it to gauge the level of systemic market stress. Investors can use it to assess when risk is elevated (positive z-scores) or subdued (negative z-scores). It helps in decision-making for strategies that depend on market volatility or risk appetite. Summary of What You See: Colorful Lines (Red, Green, Orange, Purple): Individual z-scores for each metric (VIX, MOVE, high-yield spread, credit spread). Blue Line: The aggregated Combined Z-Score that summarizes financial conditions. Red and Green Background: Red: Tight or risky financial conditions (Combined Z-Score > 0). Green: Loose or low-risk financial conditions (Combined Z-Score < 0). This visualization provides a multi-dimensional view of financial conditions at a glance, helping to identify periods of high or low risk in the markets.
진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.