OPEN-SOURCE SCRIPT
Badawy_Macro Risk Dashboard

# 🔥 **Macro Risk Dashboard – Institutional Regime Indicator**
## 📊 **Overview**
The **Macro Risk Dashboard** is a multi-asset, institutional-grade indicator designed to quantify the overall market environment into a single **Macro Score (0–100)**.
It aggregates key macro signals across:
* Volatility
* Liquidity
* Growth
* Credit Markets
Then transforms them into a **clear Risk-On / Risk-Off regime**.
👉 Built for traders who want to think like institutions — not retail noise.
---
## 🧠 **Core Idea**
Instead of relying on price alone, this indicator reads the **macro engine behind the market**:
| Component | What it Measures | Signal Logic |
| ---------- | ------------------------ | ---------------------------- |
| VIX | Market fear | Lower = Bullish |
| DXY | Dollar strength | Lower = Risk On |
| US10Y | Yields / liquidity | Lower = Liquidity expansion |
| QQQ | Growth / Tech leadership | Above MA = Bullish |
| HYG vs TLT | Credit risk appetite | Risk assets outperform bonds |
Each component contributes to a weighted score → final **Macro Score**
📌 Source logic from your script:
---
## ⚙️ **How It Works**
### 1️⃣ Scoring Engine
Each macro block contributes:
* **Liquidity (US10Y + DXY)** → 50 pts
* **Volatility (VIX)** → 25 pts
* **Growth (QQQ)** → 25 pts
* **Credit (HYG vs TLT)** → 18 pts
Score is normalized to:
👉 **0 → 100 scale**
---
### 2️⃣ Regime Detection
* 🟢 **Risk ON** → Score ≥ 70
* 🔴 **Risk OFF** → Score ≤ 45
* 🟠 **Neutral** → Between both
---
### 3️⃣ Visual Feedback
* Colored line:
* Green → Risk On
* Red → Risk Off
* Orange → Neutral
* Background shading reflects regime
* Labels appear when regime changes
* Dashboard table shows real-time macro states
---
## 📈 **How to Use It**
### 🟢 Risk ON Environment
* Favor:
* Growth stocks (QQQ, SOXL)
* Breakouts
* Trend-following
* Strategy:
* Buy dips
* Aggressive positioning
---
### 🔴 Risk OFF Environment
* Favor:
* Defensive assets
* Gold / bonds
* Shorts / hedges
* Strategy:
* Reduce exposure
* Protect capital
---
### 🟠 Neutral
* Range trading
* Lower conviction trades
* Wait for confirmation
---
## 🎯 **Best Use Cases**
* Swing Trading
* Macro Trading
* Portfolio Allocation
* Risk Management Layer (VERY powerful)
---
## ⚡ **Why This Indicator is Powerful**
* Combines **6 macro markets** into 1 signal
* Filters fake moves driven by liquidity
* Works across all timeframes
* Adapts automatically if data is missing
* Thinks like **institutional flow**, not price-only indicators
---
## ⚠️ **Important Notes**
* This is a **macro regime tool**, not a direct entry signal
* Should be combined with:
* Price action
* Volume
* Execution strategy
* No repainting (uses confirmed data)
* Slight lag due to moving averages (by design for stability)
---
## 🧪 **Pro Tip (Advanced)**
Use it as a **master filter**:
❌ Don’t take longs if Risk = OFF
❌ Don’t short aggressively if Risk = ON
👉 This alone can eliminate 50–70% of bad trades.
---
## 🏷️ **Tags**
#Macro #RiskOn #RiskOff #SmartMoney #Institutional #VIX #DXY #QQQ #Liquidity #TradingView #MarketRegime #Quant
## 📊 **Overview**
The **Macro Risk Dashboard** is a multi-asset, institutional-grade indicator designed to quantify the overall market environment into a single **Macro Score (0–100)**.
It aggregates key macro signals across:
* Volatility
* Liquidity
* Growth
* Credit Markets
Then transforms them into a **clear Risk-On / Risk-Off regime**.
👉 Built for traders who want to think like institutions — not retail noise.
---
## 🧠 **Core Idea**
Instead of relying on price alone, this indicator reads the **macro engine behind the market**:
| Component | What it Measures | Signal Logic |
| ---------- | ------------------------ | ---------------------------- |
| VIX | Market fear | Lower = Bullish |
| DXY | Dollar strength | Lower = Risk On |
| US10Y | Yields / liquidity | Lower = Liquidity expansion |
| QQQ | Growth / Tech leadership | Above MA = Bullish |
| HYG vs TLT | Credit risk appetite | Risk assets outperform bonds |
Each component contributes to a weighted score → final **Macro Score**
📌 Source logic from your script:
---
## ⚙️ **How It Works**
### 1️⃣ Scoring Engine
Each macro block contributes:
* **Liquidity (US10Y + DXY)** → 50 pts
* **Volatility (VIX)** → 25 pts
* **Growth (QQQ)** → 25 pts
* **Credit (HYG vs TLT)** → 18 pts
Score is normalized to:
👉 **0 → 100 scale**
---
### 2️⃣ Regime Detection
* 🟢 **Risk ON** → Score ≥ 70
* 🔴 **Risk OFF** → Score ≤ 45
* 🟠 **Neutral** → Between both
---
### 3️⃣ Visual Feedback
* Colored line:
* Green → Risk On
* Red → Risk Off
* Orange → Neutral
* Background shading reflects regime
* Labels appear when regime changes
* Dashboard table shows real-time macro states
---
## 📈 **How to Use It**
### 🟢 Risk ON Environment
* Favor:
* Growth stocks (QQQ, SOXL)
* Breakouts
* Trend-following
* Strategy:
* Buy dips
* Aggressive positioning
---
### 🔴 Risk OFF Environment
* Favor:
* Defensive assets
* Gold / bonds
* Shorts / hedges
* Strategy:
* Reduce exposure
* Protect capital
---
### 🟠 Neutral
* Range trading
* Lower conviction trades
* Wait for confirmation
---
## 🎯 **Best Use Cases**
* Swing Trading
* Macro Trading
* Portfolio Allocation
* Risk Management Layer (VERY powerful)
---
## ⚡ **Why This Indicator is Powerful**
* Combines **6 macro markets** into 1 signal
* Filters fake moves driven by liquidity
* Works across all timeframes
* Adapts automatically if data is missing
* Thinks like **institutional flow**, not price-only indicators
---
## ⚠️ **Important Notes**
* This is a **macro regime tool**, not a direct entry signal
* Should be combined with:
* Price action
* Volume
* Execution strategy
* No repainting (uses confirmed data)
* Slight lag due to moving averages (by design for stability)
---
## 🧪 **Pro Tip (Advanced)**
Use it as a **master filter**:
❌ Don’t take longs if Risk = OFF
❌ Don’t short aggressively if Risk = ON
👉 This alone can eliminate 50–70% of bad trades.
---
## 🏷️ **Tags**
#Macro #RiskOn #RiskOff #SmartMoney #Institutional #VIX #DXY #QQQ #Liquidity #TradingView #MarketRegime #Quant
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.