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.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.