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
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.