OPEN-SOURCE SCRIPT
Tactical Regime Score v3 (Dynamic Adaptive)

Quant-Grade Market Regime Classification Engine
1. Executive Summary
Market "Regime" is the most critical yet often misunderstood variable in trading. Applying a trending strategy to a mean-reverting market is a mathematical death sentence. The Tactical Regime Score v3 (Dynamic Adaptive) is an institutional-grade tool that utilizes the Augmented Dickey-Fuller (ADF) Test logic to classify price action into two distinct physical states: Mean Reversion (Stationary) and Trending/Random Walk (Non-Stationary).
2. The Engine: How it Works
Unlike retail indicators that rely on lagged moving averages, this engine uses Ordinary Least Squares (OLS) Regression to calculate a normalized ADF-style statistic in real-time.
Stationarity Detection: It measures the "slope" of price changes relative to their lagged values. A negative slope indicates that price has a "restoring force" pulling it back to a mean (Stationarity).
Dynamic Adaptive Thresholding: Static thresholds are a "Retail Trap." Markets evolve; a stationary state in a low-volatility period looks different than one in a high-volatility period. This script uses Linear Interpolation Percentiles over a 500-bar lookback to determine a relative threshold for "restoring force," making it self-adjusting to current market conditions.
3. Key Features
Regime-Colorized Columns:
Green (Mean Reversion): The price is mathematically stationary. Statistical arbitrage and mean-reversion strategies (Oscillators, Mean Reversion Levels) are favored.
Red (Trending/Random): Price is non-stationary. Directional momentum or "Random Walk" dominates. Trend-following logic or breakout strategies are favored.
HV-Percentile Scoring: The height of the columns represents the Historical Volatility (HV) Percentile. A high score in a Red regime indicates a high-conviction trend; a high score in a Green regime indicates an overextended mean-reversion move.
Real-time Dashboard: Displays the raw ADF value, the current dynamic threshold, and the finalized Tactical Score for immediate situational awareness.
4. Tactical SOP (How to use)
Regime Filter: Check the column color before entering a trade.
If Green, do not chase breakouts; look for "Rubber Band" snaps back to the POC.
If Red, do not attempt to "pick tops" or "pick bottoms"; follow the momentum.
Confidence Check: * Score > 75 (High Confidence): Strong physical regime. Expect the current behavior (Trending or Reverting) to persist.
Score < 25 (Low Confidence): "Dead Zone." Market is indecisive. Market makers are usually range-bound.
ADF Scaled Line (White): Watch the interaction between the White Line and the Blue Threshold line. A cross below the threshold is the "Physical Event" that triggers the Green (Mean Reversion) state.
5. Technical Parameters
ADF Lookback: Controls the sensitivity of stationarity detection.
Adaptive Percentile (%): Determines how "strict" the system is before declaring a mean-reversion state. Higher values (35-40%) make the script more likely to turn green.
HV Window: Sets the lookback for the Historical Volatility ranking.
Publishing Instructions for TradingView:
Category: Select Volatility and Indicators.
Tags: Regime, ADF, Mean Reversion, Quantitative, Market Structure.
Description: Copy and paste the text above.
Note: Ensure your chart displays the indicator clearly with the dashboard visible in the screenshot.
This script is designed for traders who prioritize objective data over subjective intuition. Reality is cold; trade the numbers.
1. Executive Summary
Market "Regime" is the most critical yet often misunderstood variable in trading. Applying a trending strategy to a mean-reverting market is a mathematical death sentence. The Tactical Regime Score v3 (Dynamic Adaptive) is an institutional-grade tool that utilizes the Augmented Dickey-Fuller (ADF) Test logic to classify price action into two distinct physical states: Mean Reversion (Stationary) and Trending/Random Walk (Non-Stationary).
2. The Engine: How it Works
Unlike retail indicators that rely on lagged moving averages, this engine uses Ordinary Least Squares (OLS) Regression to calculate a normalized ADF-style statistic in real-time.
Stationarity Detection: It measures the "slope" of price changes relative to their lagged values. A negative slope indicates that price has a "restoring force" pulling it back to a mean (Stationarity).
Dynamic Adaptive Thresholding: Static thresholds are a "Retail Trap." Markets evolve; a stationary state in a low-volatility period looks different than one in a high-volatility period. This script uses Linear Interpolation Percentiles over a 500-bar lookback to determine a relative threshold for "restoring force," making it self-adjusting to current market conditions.
3. Key Features
Regime-Colorized Columns:
Green (Mean Reversion): The price is mathematically stationary. Statistical arbitrage and mean-reversion strategies (Oscillators, Mean Reversion Levels) are favored.
Red (Trending/Random): Price is non-stationary. Directional momentum or "Random Walk" dominates. Trend-following logic or breakout strategies are favored.
HV-Percentile Scoring: The height of the columns represents the Historical Volatility (HV) Percentile. A high score in a Red regime indicates a high-conviction trend; a high score in a Green regime indicates an overextended mean-reversion move.
Real-time Dashboard: Displays the raw ADF value, the current dynamic threshold, and the finalized Tactical Score for immediate situational awareness.
4. Tactical SOP (How to use)
Regime Filter: Check the column color before entering a trade.
If Green, do not chase breakouts; look for "Rubber Band" snaps back to the POC.
If Red, do not attempt to "pick tops" or "pick bottoms"; follow the momentum.
Confidence Check: * Score > 75 (High Confidence): Strong physical regime. Expect the current behavior (Trending or Reverting) to persist.
Score < 25 (Low Confidence): "Dead Zone." Market is indecisive. Market makers are usually range-bound.
ADF Scaled Line (White): Watch the interaction between the White Line and the Blue Threshold line. A cross below the threshold is the "Physical Event" that triggers the Green (Mean Reversion) state.
5. Technical Parameters
ADF Lookback: Controls the sensitivity of stationarity detection.
Adaptive Percentile (%): Determines how "strict" the system is before declaring a mean-reversion state. Higher values (35-40%) make the script more likely to turn green.
HV Window: Sets the lookback for the Historical Volatility ranking.
Publishing Instructions for TradingView:
Category: Select Volatility and Indicators.
Tags: Regime, ADF, Mean Reversion, Quantitative, Market Structure.
Description: Copy and paste the text above.
Note: Ensure your chart displays the indicator clearly with the dashboard visible in the screenshot.
This script is designed for traders who prioritize objective data over subjective intuition. Reality is cold; trade the numbers.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.