OPEN-SOURCE SCRIPT
Cập nhật Miggoy's regime overlay

A market-regime dashboard that scores the overall environment for swing trading and colors your chart background green, yellow, or red so you can tell at a glance whether conditions favor putting on risk.
The script grades three independent conditions, each worth one point:
1 · Price Structure — SPY stacked above its 10 EMA, with the 10 EMA above the 20 EMA. Confirms a clean short-term uptrend with price leading.
2 · Net 52-Week Highs minus Lows — More new highs than new lows across the market. A positive read means broad participation rather than a narrow rally.
3 · Volatility — Fear draining out of the tape, defined as VIX below its 20 EMA, and the 20 EMA below the 50 EMA (50 > 20 EMA > VIX). Signals a calm, trending environment rather than a spiking, defensive one.
Regime scoring
3 / 3 → GREEN — Full risk per trade, full aggression.
2 / 3 → YELLOW — Half risk, best setups only.
0–1 / 3 → RED — List building, no trades.
The chart background tints to match the regime, and a table summarizes each condition with a pass/fail check, the underlying values, and the suggested action. A "days in regime" counter tracks how long the current state has held.
Notes
All conditions are calculated on the daily timeframe regardless of your chart's timeframe, so the regime read stays consistent whether you're looking at a daily or an intraday chart.
Calculations use confirmed daily data with no lookahead, so the indicator does not repaint.
The high/low inputs default to YRHI.US and YRLO.US (52-week new highs and new lows). Adjust the symbols in settings if your data provider uses different tickers.
Alerts are included for each regime transition (green, yellow, red).
This is a decision-support tool for gauging market conditions, not a buy/sell signal generator. It tells you whether the environment supports trading, not what to trade.
The script grades three independent conditions, each worth one point:
1 · Price Structure — SPY stacked above its 10 EMA, with the 10 EMA above the 20 EMA. Confirms a clean short-term uptrend with price leading.
2 · Net 52-Week Highs minus Lows — More new highs than new lows across the market. A positive read means broad participation rather than a narrow rally.
3 · Volatility — Fear draining out of the tape, defined as VIX below its 20 EMA, and the 20 EMA below the 50 EMA (50 > 20 EMA > VIX). Signals a calm, trending environment rather than a spiking, defensive one.
Regime scoring
3 / 3 → GREEN — Full risk per trade, full aggression.
2 / 3 → YELLOW — Half risk, best setups only.
0–1 / 3 → RED — List building, no trades.
The chart background tints to match the regime, and a table summarizes each condition with a pass/fail check, the underlying values, and the suggested action. A "days in regime" counter tracks how long the current state has held.
Notes
All conditions are calculated on the daily timeframe regardless of your chart's timeframe, so the regime read stays consistent whether you're looking at a daily or an intraday chart.
Calculations use confirmed daily data with no lookahead, so the indicator does not repaint.
The high/low inputs default to YRHI.US and YRLO.US (52-week new highs and new lows). Adjust the symbols in settings if your data provider uses different tickers.
Alerts are included for each regime transition (green, yellow, red).
This is a decision-support tool for gauging market conditions, not a buy/sell signal generator. It tells you whether the environment supports trading, not what to trade.
Phát hành các Ghi chú
Made the red background overlay brighterMã 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.