OPEN-SOURCE SCRIPT
Market Regime LT Direction (Long-Term Objective Filter)

Overview
The Market Regime LT Direction indicator is a heavy-duty, multi-factor scoring engine designed to identify the macro market regime. Unlike conventional indicators that rely on a single moving average, this script utilizes a sophisticated matrix of several distinct technical factors across different lookback periods to classify the long-term market environment.
To ensure absolute objectivity and eliminate the pitfalls of over-optimization, this indicator features a zero-input design — there are no parameters to tweak, giving you a robust, curve-fitting-immune view of institutional trend direction.
Why You Should Use This Indicator (The Value Proposition)
Traders often fail because they misjudge the macro environment. A system designed for a secular bull market will fail miserably when the macro regime shifts to a structural bear market or an extended sideways distribution.
How It Works & Underlying Logic
The indicator separates its engine into two primary layers: a Visual Layer and a Scoring Layer.
1. The Visual Layer
The underlying histogram is a slow-moving, high-period MACD calculated on the typical price (hlc3). This smooths out micro-volatility and visualizes structural macro-momentum.
2. The Scoring Layer (Weighted Confluence Matrix)
The color of the histogram bars is dictated by a strict mathematical matrix. Factors are split into two categories and weighted based on macro relevance:
The script combines these metrics into a standardized Total Score ranging between -3.0 and +3.0.
How to Interpret It for Your Trading
Pro-Tip: Pair this with the Market Regime ST Direction indicator. When the Short-Term indicator aligns with this Long-Term macro engine (e.g., both turning Green), you have a mathematically high-probability environment for trend-following expansions.
The Market Regime LT Direction indicator is a heavy-duty, multi-factor scoring engine designed to identify the macro market regime. Unlike conventional indicators that rely on a single moving average, this script utilizes a sophisticated matrix of several distinct technical factors across different lookback periods to classify the long-term market environment.
To ensure absolute objectivity and eliminate the pitfalls of over-optimization, this indicator features a zero-input design — there are no parameters to tweak, giving you a robust, curve-fitting-immune view of institutional trend direction.
Why You Should Use This Indicator (The Value Proposition)
Traders often fail because they misjudge the macro environment. A system designed for a secular bull market will fail miserably when the macro regime shifts to a structural bear market or an extended sideways distribution.
- Immunity to Curve-Fitting: By fixing the core mathematical constants, this indicator provides an unbiased, baseline truth of the market structure across any asset class (Equities, Crypto, Forex, or Commodities).
- Multi-Factor Confluence: Instead of guessing based on a single line, it dynamically calculates a mathematical "Total Score" using trend persistence, moving average geometry, linear regression slope, and momentum.
- Macro Filter for Portfolio Allocation: It is an excellent tool for swing traders and long-term investors to manage risk, determine position sizing, or implement an overall portfolio "Risk-On / Risk-Off" switch.
How It Works & Underlying Logic
The indicator separates its engine into two primary layers: a Visual Layer and a Scoring Layer.
1. The Visual Layer
The underlying histogram is a slow-moving, high-period MACD calculated on the typical price (hlc3). This smooths out micro-volatility and visualizes structural macro-momentum.
2. The Scoring Layer (Weighted Confluence Matrix)
The color of the histogram bars is dictated by a strict mathematical matrix. Factors are split into two categories and weighted based on macro relevance:
- Low Relevance Score (Short-Term Confluence) like 20 EMA slope direction, fast MACD momentum slope changes and price location relative to the 50 EMA.
- High Relevance Score (Long-Term Structure) like price location relative to the 200 SMA, 50 EMA location relative to the 200 SMA, recent swing high/low persistence over a 30-bar window and 100-candle Linear Regression slope.
The script combines these metrics into a standardized Total Score ranging between -3.0 and +3.0.
How to Interpret It for Your Trading
- 🟩 Lime (Macro Bullish Regime — Score > 1): Complete structural alignment to the upside. Long-term institutional buying is in control. Aggressive Long bias / Risk-On.
- 🟥 Red (Macro Bearish Regime — Score < -1): Complete structural alignment to the downside. Macro distribution or a structural markdown is underway. Aggressive Short bias / Defensive capital preservation.
- 🟨 Yellow (Transitional / Sideways Regime): The factors are in conflict, or the macro trend is losing momentum. The market is consolidating or preparing for a regime shift. Neutral stance / Reduce position sizes / Expect choppy price action.
Pro-Tip: Pair this with the Market Regime ST Direction indicator. When the Short-Term indicator aligns with this Long-Term macro engine (e.g., both turning Green), you have a mathematically high-probability environment for trend-following expansions.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.