OPEN-SOURCE SCRIPT

Financial Crisis Predictor - Doomsday Clock

The **Financial Crisis Predictor - Doomsday Clock** is a composite indicator that evaluates multiple market conditions to determine financial risk levels. It combines four key metrics: market volatility (via VIX), yield curve spread, stock market momentum, and credit risk (via high-yield spread). Each metric contributes to a weighted "risk score," scaled between 0 and 100, which helps gauge the probability of a financial crisis. Here's a breakdown of how it works:

### 1. **Market Volatility (VIX)**
- **How it's measured:**
- Uses the VIX index, which represents expected market volatility.
- Applies two exponential moving averages (EMAs) to smooth out the data—one fast and one slow.
- Triggers a signal if the fast EMA crosses above the slow EMA and VIX exceeds a defined threshold (default is 30).
- **Weighting:**
- Contributes up to 35% of the total risk score when active.

### 2. **Yield Curve Spread**
- **How it's measured:**
- Takes the difference between the yields of 10-year and 2-year U.S. Treasury bonds (inversion indicates recession risk).
- If the spread drops below a certain threshold (default is 0.2), it signals a potential recession.
- **Weighting:**
- Contributes up to 25% of the risk score.

### 3. **Stock Market Momentum**
- **How it's measured:**
- Analyzes the S&P 500 (SPY) using a 20-day EMA for price momentum.
- Checks for a cross under the 20-day EMA and if the 5-day rate of change (ROC) is less than -2.
- This combination signals bearish market momentum.
- **Weighting:**
- Contributes up to 20% of the risk score.

### 4. **Credit Risk (High Yield Spread)**
- **How it's measured:**
- Assesses high-yield corporate bond spreads using EMAs, similar to the VIX logic.
- A crossover of the fast EMA above the slow EMA combined with spreads exceeding a defined threshold (default is 5.0) indicates increased credit risk.
- **Weighting:**
- Contributes up to 20% of the total risk score.

### 5. **Risk Score Calculation**
- The final **risk score** ranges from 0 to 100 and is calculated using the weighted sum of the four indicators.
- The score is smoothed to minimize false signals and maintain stability.

### 6. **Risk Zones**
- **Extreme Risk:** If the risk score is ≥ 75, indicating a severe crisis warning.
- **High Risk:** If the risk score is between 15 and 75, signaling heightened risk.
- **Moderate Risk:** If the risk score is between 10 and 15, representing potential concerns.
- **Low Risk:** If the risk score is < 10, suggesting stable conditions.

### 7. **Visual & Alerts**
- The indicator plots the risk score on a chart with color-coded backgrounds to indicate risk levels: green (low), yellow (moderate), orange (high), and red (extreme).
- Alert conditions are set for each risk zone, notifying users when the risk level transitions into a higher zone.

This indicator aims to quickly detect potential financial crises by aggregating signals from key market factors, making it a versatile tool for traders, analysts, and risk managers.
Candlestick analysisChart patternsCycles

오픈 소스 스크립트

진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?

면책사항