OPEN-SOURCE SCRIPT
Macro Risk Sentinel

🛡️ Macro Risk Sentinel: Smart Crash Detector & Trend Filter
The Macro Risk Sentinel is a powerful risk management tool built to protect your trading from sudden market dumps. Instead of relying on lagging price indicators, this script looks under the hood of the market—tracking hidden credit health and volatility data—to spot panic before it destroys your chart.
Whether you trade manually or run automated algorithmic swing trading strategies, the Sentinel acts as a safety switch.
⚙️ How It Works: The "Smart Recovery" System
Most crash indicators lock you out of the market for way too long, making you miss the most profitable part of the rebound. We fixed this with our built-in Smart Recovery logic.
🔴 Red Zone (Lockdown): Real market panic detected. The indicator turns your chart background red, signaling a strict "Risk-Off" state. It's time to cut longs or pause your trading bots.
🟡 Yellow Zone (Caution): Early warning signs. The market is getting choppy. This is your cue to tighten stop-losses and reduce position sizes.
🚀 Smart Unlock: The game-changer. While in a lockdown, the Sentinel constantly monitors the market in the background. As soon as volatility drops and a healthy price trend begins, it fires a "Smart Unlock" signal. You get the green light to jump back in exactly as the new uptrend starts, without waiting for a blind timer to run out.
✨ Key Features
Under-the-Hood Data: Driven by real market stress metrics (Volatility and High-Yield Credit ratios), not just simple moving averages.
100% Backtest Safe (No Repaint): Built with strict causal logic and zero lookahead bias. What you see on historical bars is exactly what would have printed live, making it perfectly safe to build automated strategies around.
Clean Live Dashboard: A simple, non-intrusive panel on your chart shows the current market state, the recovery conditions, and the lockdown countdown at a glance.
Visual Clarity: Intuitive background colorings and clear chart markers (Crash ⛔, Smart Recovery 🚀) so you never have to second-guess the market environment.
Fully Customizable: Easily tweak the trigger thresholds and lockdown duration to match your specific trading style and risk tolerance.
🎯 Perfect For:
Algorithmic traders who need a "kill switch" for their automated systems.
Swing traders tired of getting caught and holding bags during sudden market crashes.
Systematic traders looking to automate their risk-on/risk-off rules based on hard data.
The Macro Risk Sentinel is a powerful risk management tool built to protect your trading from sudden market dumps. Instead of relying on lagging price indicators, this script looks under the hood of the market—tracking hidden credit health and volatility data—to spot panic before it destroys your chart.
Whether you trade manually or run automated algorithmic swing trading strategies, the Sentinel acts as a safety switch.
⚙️ How It Works: The "Smart Recovery" System
Most crash indicators lock you out of the market for way too long, making you miss the most profitable part of the rebound. We fixed this with our built-in Smart Recovery logic.
🔴 Red Zone (Lockdown): Real market panic detected. The indicator turns your chart background red, signaling a strict "Risk-Off" state. It's time to cut longs or pause your trading bots.
🟡 Yellow Zone (Caution): Early warning signs. The market is getting choppy. This is your cue to tighten stop-losses and reduce position sizes.
🚀 Smart Unlock: The game-changer. While in a lockdown, the Sentinel constantly monitors the market in the background. As soon as volatility drops and a healthy price trend begins, it fires a "Smart Unlock" signal. You get the green light to jump back in exactly as the new uptrend starts, without waiting for a blind timer to run out.
✨ Key Features
Under-the-Hood Data: Driven by real market stress metrics (Volatility and High-Yield Credit ratios), not just simple moving averages.
100% Backtest Safe (No Repaint): Built with strict causal logic and zero lookahead bias. What you see on historical bars is exactly what would have printed live, making it perfectly safe to build automated strategies around.
Clean Live Dashboard: A simple, non-intrusive panel on your chart shows the current market state, the recovery conditions, and the lockdown countdown at a glance.
Visual Clarity: Intuitive background colorings and clear chart markers (Crash ⛔, Smart Recovery 🚀) so you never have to second-guess the market environment.
Fully Customizable: Easily tweak the trigger thresholds and lockdown duration to match your specific trading style and risk tolerance.
🎯 Perfect For:
Algorithmic traders who need a "kill switch" for their automated systems.
Swing traders tired of getting caught and holding bags during sudden market crashes.
Systematic traders looking to automate their risk-on/risk-off rules based on hard data.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.