OPEN-SOURCE SCRIPT

Global Debt-to-GDP Dashboard

757
I've created this macro indicator to monitor world debt. The Global Debt-to-GDP Dashboard helps you to track, compare, and analyze sovereign and private debt levels across 20 major economies.
It provides institutional-grade debt analysis, allowing traders, long term investors and macro investors to identify systemic risks, divergences from global norms, and accelerating debt trends that could signal future economic instability or opportunities.

What It Does
This indicator transforms complex macroeconomic data into actionable insights to understand country leverage by:
  • Tracking Dual Debt Metrics: Monitors both government debt-to-GDP and private debt-to-GDP ratios for 20 countries. This provides a complete picture of total leverage in each economy.
  • Divergence Analysis: Compares each country's debt levels against the world average (calculated from selected countries), instantly highlighting which economies are over-leveraged or under-leveraged relative to global norms.
  • Velocity Tracking: Calculates the rate of change in debt divergence, identifying which countries are rapidly increasing or decreasing their debt burden.
  • Risk Assessment: Automatically categorizes countries by risk level using color-coded visual indicators

Key Features
  • 20 Major Economies: USA, China, Japan, Germany, UK, France, Italy, Canada, Spain, Australia, South Korea, Brazil, India, Mexico, Switzerland, Singapore, Norway, Saudi Arabia, Russia, and Turkey
  • Simultaneous Visualization: Plot all selected countries on a single chart with unique color coding for easy identification
  • Dynamic Country Selection: Enable/disable countries to focus on specific regions or economic blocs

Three Divergence Analysis Modes
  • Government Only: Analyze sovereign debt divergence from government debt average
  • Private Only: Focus exclusively on private sector leverage (excludes countries without private debt data)
  • Total (Gov + Private): Comprehensive view of total economy-wide debt burden [DEFAULT]

Use Cases
For Macro Traders
  • Identify Sovereign Risk: Spot countries with unsustainable debt trajectories before credit events
  • Currency Pairs: Correlate debt divergence with currency strength/weakness
  • Bond Markets: Anticipate yield spread movements based on relative debt positions
  • Risk-On/Risk-Off: Use global debt velocity as a systemic risk indicator

For Long-Term Investors
  • Country Allocation: Make informed decisions about geographic exposure
  • Risk Management: Avoid over-exposure to high-debt economies
  • Opportunity Identification: Find under-leveraged economies with growth potential
  • Portfolio Rebalancing: Use debt trends as signals for portfolio adjustments

How to Use
  • Initial Setup: Select the countries you want to monitor from the Settings panel
  • Choose Divergence Type: Select Government Only, Private Only, or Total debt analysis
  • Configure Display: Adjust table position, text size, and sorting preferences
  • Set Alerts (Optional): Define your alert thresholds and enable notifications

Table Risk Scores:
🔴🔴🔴 Extreme Risk: Divergence > +100pp above average
🔴🔴 High Risk: Divergence > +50pp above average
🟠 Moderate Risk: Divergence > 0pp above average
🟢 Low Risk: Divergence > -50pp below average
🟢🟢 Very Low Risk: Divergence < -50pp below average
NOTE: "Low Risk" and low-debt might also mean that a country is unable to finance through the issuance of government debt. This is not necessarily a good thing and might not correspond to low risk.

Velocity Indicators:
⬆️⬆️⬆️ Rapid Acceleration: +5pp or more per period
⬆️⬆️ Strong Acceleration: +2 to +5pp per period
⬆️ Moderate Increase: +0.5 to +2pp per period
➡️ Stable: -0.5 to +0.5pp per period
⬇️ Moderate Decrease: -2 to -0.5pp per period
⬇️⬇️ Strong Deceleration: -5 to -2pp per period
⬇️⬇️⬇️ Rapid Deceleration: -5pp or less per period

Important Notes
  • Data Availability: Some countries lack private debt data (e.g., China, India, Brazil).
  • World Average Calculation: The world average is dynamically calculated based on your selected countries, not a fixed global figure. This allows for custom peer group comparisons.
  • Percentage Points vs Percentages: All divergence values are in percentage points (pp), representing the absolute difference from the average, not a relative percentage change.

Let me know if you have comments or suggestions.
Truly yours, Henrique Centieiro

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.