OPEN-SOURCE SCRIPT
Market Regime ST Direction (Short-Term Filter)

Overview
The Market Regime ST Direction indicator is a streamlined tool designed to identify the short-term market environment, specifically optimized for the Daily Chart. It serves as an über-clean trend and phase filter built to protect your trading strategy from taking unnecessary losses during difficult, choppy market conditions.
The indicator focuses exclusively on market direction, intentionally filtering out volatility noise and secondary market factors.
Why You Should Use This Indicator (The Value Proposition)
It is a fundamental truth in trading: no single strategy works in all market environments. Trend-following systems bleed capital in sideways ranges, while mean-reversion setups get destroyed in strong, runaway trends.
How It Works & Underlying Logic
The script intelligently decouples visual momentum from the actual trend regime logic:
How to Interpret It for Your Trading
Pro-Tip: Apply this indicator to the Daily chart of your favorite asset. If you trade a trend-following strategy on lower timeframes (e.g., 1H or 15M), strictly filter your entries based on the color of the Daily regime.
The Market Regime ST Direction indicator is a streamlined tool designed to identify the short-term market environment, specifically optimized for the Daily Chart. It serves as an über-clean trend and phase filter built to protect your trading strategy from taking unnecessary losses during difficult, choppy market conditions.
The indicator focuses exclusively on market direction, intentionally filtering out volatility noise and secondary market factors.
Why You Should Use This Indicator (The Value Proposition)
It is a fundamental truth in trading: no single strategy works in all market environments. Trend-following systems bleed capital in sideways ranges, while mean-reversion setups get destroyed in strong, runaway trends.
- Smart Loss Filtering: This indicator helps you decide when not to trade. It identifies unprofitable market phases before your account takes a hit.
- The Market Traffic Light: Use it as a higher-timeframe filter. Only allow long trades in the bullish (green) regime, short trades in the bearish (red) regime, and pause your strategy during the choppy (gray) regime.
- Clarity Over Overtrading: With its clear, color-coded separation, you can instantly see whether the market has a clean directional bias or is caught in the "chop."
How It Works & Underlying Logic
The script intelligently decouples visual momentum from the actual trend regime logic:
- The Visual Foundation (MACD Histogram): The baseline visual consists of a classic MACD histogram calculated on the typical price (hlc3). This displays the current momentum of the market.
- The Regime Filter (EMA Slope): Crucially, the color of the bars is not determined by the MACD. Instead, it is driven entirely by the slope (steepness) of the fast 20 EMA.
- The Noise Filter (Threshold): To prevent the indicator from constantly flickering back and forth with minor price ticks, a percentage-based threshold (Sideways Threshold, default: 0.15%) is implemented. The market is only classified as trending when the EMA slope cleanly exceeds this threshold.
How to Interpret It for Your Trading
- 🟩 Lime (Bullish Regime): The 20 EMA slope is strongly positive. The short-term trend is firmly up. Focus on Long setups.
- 🟥 Red (Bearish Regime): The 20 EMA slope is strongly negative. The short-term trend is firmly down. Focus on Short setups.
- ⬜ Gray (Sideways/Chop): The slope is too flat and remains within the threshold boundaries. Caution: This is where trend strategies usually experience their heaviest drawdowns. This is an excellent time to sit on your hands and wait on the sidelines.
Pro-Tip: Apply this indicator to the Daily chart of your favorite asset. If you trade a trend-following strategy on lower timeframes (e.g., 1H or 15M), strictly filter your entries based on the color of the Daily regime.
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.
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.