OPEN-SOURCE SCRIPT
CCI - Country Crisis Index

Country Crisis Index (CCI) — Real-Time Country-Level Risk Dashboard
The Country Crisis Index answers one question: how bad is it HERE, specifically?
While global indices tell you what the world is doing, CCI drills into a single country's stress across six dimensions — equity markets, currency flight, inflation, sovereign credit, external vulnerability, and political sentiment — and compresses it into a single 0-100 score with actionable trading guidance.
🔢 Six Scoring Modules
Module Weight What It Captures
M1 Domestic Equity Stress 0-20 Benchmark z-score, bank/benchmark ratio, smallcap rotation, VIX, sector breadth
M2 Currency & Capital Flow 0-20 FX rate-of-change (1/3/5-bar with decay), FX z-score, yield spikes, sovereign spread, DXY-adjusted move
M3 Inflation & Cost of Living 0-15 Oil-in-local-currency, gold-in-local breakout, wheat, copper, natural gas
M4 Sovereign & Credit Risk 0-20 Sovereign spread level + momentum, bank sector weakness, HYG credit, correlation break
M5 External Vulnerability 0-15 Oil import stress, trade partner z-score, US 10Y momentum, DXY strength
M6 Political & Sentiment 0-10 VIX event risk, PSU/private divergence, smallcap drawdown, sustained volatility
🚦 Five Threat Levels
L0 CALM (0-19) — Full deployment. Business as usual.
L1 ALERT (20-39) — Something twitching. Tighten stops.
L2 WARNING (40-59) — Hedge the book. Rotate to quality.
L3 DANGER (60-79) — Capital preservation mode. Cut weak names.
L4 CRISIS (80-100) — Maximum defensive. Survive first, profit later.
📊 9-Row Dashboard
The table packs everything a trader needs into a single glance:
Score & Level — CCI value with threat classification and country code
Signal & Direction — Action signal (DEPLOY → EXIT ALL) with crisis momentum (SURGING / RISING / FLAT / COOLING / RETREATING)
7-Bar Sparkline — Colour-coded trend: red = crisis rising, green = easing, gray = steady. Includes Δ7 and Δ1 deltas
Exposure — Recommended portfolio allocation percentage with guidance text
Driver — Which module is dominant plus active feed tags (Bank↓, Oil(52H), VIX↑, etc.)
Mood — 3-line editorial combining observation + reaction + insight, with 465+ sentence combinations adapting to timeframe, threat level, and trend direction
Currency — Local exchange rate (e.g., ₹84.35/$), FX direction, sovereign spread, target stock move
Indices — 7-index heatmap with last session % change and ▲/▼ arrows
Status — Market open/closed with distinct colours for after hours, holidays, and weekends (OHLC-verified, not just clock-based)
🌏 10 Country Profiles
Select from the dropdown: India (default, fully implemented), United States, United Kingdom, Japan, Germany, China, Australia, Brazil, South Korea, Turkey.
Each profile maps 11 country-specific symbols plus configuration flags for FX direction, emerging market volatility scaling, oil importer weighting, timezone, and market hours.
⚙️ Key Mechanics
Asymmetric Smoothing — Crisis rises fast (3-bar EMA), eases slowly (10-bar EMA). Designed to catch the elevator down but not the escalator up.
Convergence Multiplier — When 3+ modules fire simultaneously, the score amplifies (1.15x to 1.5x). Multi-front stress is worse than the sum of parts.
EM Volatility Scaling — Emerging market FX thresholds are scaled wider (India 1.2x, Turkey 1.8x) because a 1% move in the rupee is not the same as 1% in the dollar.
Timeframe Adaptive — Works on any chart timeframe. All data feeds use chart resolution. Mood text adapts language for intraday scalpers, daily swing traders, and weekly allocators.
Holiday Detection — Uses OHLC stale-data verification, not just clock hours. Correctly identifies exchange holidays even on 24/7 chart symbols.
📡 Webhook JSON Export
Full indicator state exported as JSON via TradingView alerts — score, all six module values, 22 price feeds, Δ7/Δ1 deltas, dominant driver, exposure, session status, mood text, sub-headline, and multi-sentence narrative. Ready for downstream apps, dashboards, or notification systems.
🔗 Companion to WCI
CCI is designed to work alongside the World Crisis Index (WCI). WCI answers "how bad is the world?" — CCI answers "how bad is it here?" Together they give you global macro context and country-specific risk in one view. Default table positions avoid overlap (WCI top-right, CCI bottom-right).
Data: 22 of 40 request.security() calls. No repainting. Pine Script v6.
The Country Crisis Index answers one question: how bad is it HERE, specifically?
While global indices tell you what the world is doing, CCI drills into a single country's stress across six dimensions — equity markets, currency flight, inflation, sovereign credit, external vulnerability, and political sentiment — and compresses it into a single 0-100 score with actionable trading guidance.
🔢 Six Scoring Modules
Module Weight What It Captures
M1 Domestic Equity Stress 0-20 Benchmark z-score, bank/benchmark ratio, smallcap rotation, VIX, sector breadth
M2 Currency & Capital Flow 0-20 FX rate-of-change (1/3/5-bar with decay), FX z-score, yield spikes, sovereign spread, DXY-adjusted move
M3 Inflation & Cost of Living 0-15 Oil-in-local-currency, gold-in-local breakout, wheat, copper, natural gas
M4 Sovereign & Credit Risk 0-20 Sovereign spread level + momentum, bank sector weakness, HYG credit, correlation break
M5 External Vulnerability 0-15 Oil import stress, trade partner z-score, US 10Y momentum, DXY strength
M6 Political & Sentiment 0-10 VIX event risk, PSU/private divergence, smallcap drawdown, sustained volatility
🚦 Five Threat Levels
L0 CALM (0-19) — Full deployment. Business as usual.
L1 ALERT (20-39) — Something twitching. Tighten stops.
L2 WARNING (40-59) — Hedge the book. Rotate to quality.
L3 DANGER (60-79) — Capital preservation mode. Cut weak names.
L4 CRISIS (80-100) — Maximum defensive. Survive first, profit later.
📊 9-Row Dashboard
The table packs everything a trader needs into a single glance:
Score & Level — CCI value with threat classification and country code
Signal & Direction — Action signal (DEPLOY → EXIT ALL) with crisis momentum (SURGING / RISING / FLAT / COOLING / RETREATING)
7-Bar Sparkline — Colour-coded trend: red = crisis rising, green = easing, gray = steady. Includes Δ7 and Δ1 deltas
Exposure — Recommended portfolio allocation percentage with guidance text
Driver — Which module is dominant plus active feed tags (Bank↓, Oil(52H), VIX↑, etc.)
Mood — 3-line editorial combining observation + reaction + insight, with 465+ sentence combinations adapting to timeframe, threat level, and trend direction
Currency — Local exchange rate (e.g., ₹84.35/$), FX direction, sovereign spread, target stock move
Indices — 7-index heatmap with last session % change and ▲/▼ arrows
Status — Market open/closed with distinct colours for after hours, holidays, and weekends (OHLC-verified, not just clock-based)
🌏 10 Country Profiles
Select from the dropdown: India (default, fully implemented), United States, United Kingdom, Japan, Germany, China, Australia, Brazil, South Korea, Turkey.
Each profile maps 11 country-specific symbols plus configuration flags for FX direction, emerging market volatility scaling, oil importer weighting, timezone, and market hours.
⚙️ Key Mechanics
Asymmetric Smoothing — Crisis rises fast (3-bar EMA), eases slowly (10-bar EMA). Designed to catch the elevator down but not the escalator up.
Convergence Multiplier — When 3+ modules fire simultaneously, the score amplifies (1.15x to 1.5x). Multi-front stress is worse than the sum of parts.
EM Volatility Scaling — Emerging market FX thresholds are scaled wider (India 1.2x, Turkey 1.8x) because a 1% move in the rupee is not the same as 1% in the dollar.
Timeframe Adaptive — Works on any chart timeframe. All data feeds use chart resolution. Mood text adapts language for intraday scalpers, daily swing traders, and weekly allocators.
Holiday Detection — Uses OHLC stale-data verification, not just clock hours. Correctly identifies exchange holidays even on 24/7 chart symbols.
📡 Webhook JSON Export
Full indicator state exported as JSON via TradingView alerts — score, all six module values, 22 price feeds, Δ7/Δ1 deltas, dominant driver, exposure, session status, mood text, sub-headline, and multi-sentence narrative. Ready for downstream apps, dashboards, or notification systems.
🔗 Companion to WCI
CCI is designed to work alongside the World Crisis Index (WCI). WCI answers "how bad is the world?" — CCI answers "how bad is it here?" Together they give you global macro context and country-specific risk in one view. Default table positions avoid overlap (WCI top-right, CCI bottom-right).
Data: 22 of 40 request.security() calls. No repainting. Pine Script v6.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.