OPEN-SOURCE SCRIPT

Adaptive Market Regime Map

256
Adaptive Market Regime Map is a chart-overlay context tool that separates directional conditions from volatility conditions. It is designed to help traders describe the current market environment without presenting buy or sell signals.


WHAT IT SHOWS

The indicator organizes market context into two layers:

• Directional regime: Bullish, Bearish, or Neutral
• Volatility state: Compressed, Normal, or Expanding

A layered corridor is plotted around an adaptive equilibrium line. Its width responds to ATR, while its color and intensity reflect the current directional regime and measured trend strength.

In bullish conditions, the lower half of the corridor is emphasized as support context. In bearish conditions, the upper half is emphasized as resistance context. These areas are descriptive context zones, not fixed support or resistance levels and not trade-entry signals.


HOW IT WORKS

The directional engine combines:

• the distance between a fast EMA and the equilibrium EMA, normalized by ATR;
• the slope of the equilibrium EMA, also normalized by ATR;
• path efficiency, calculated from net movement relative to total movement over the selected window.

The resulting directional score is bounded and compared with the Trend Threshold to classify the market as Bullish, Bearish, or Neutral.

The volatility engine compares current ATR with a moving baseline of ATR:

• below the Compression Ratio: Compressed
• above the Expansion Ratio: Expanding
• between both thresholds: Normal

The dashboard displays the current regime, normalized strength, volatility state, and the number of bars spent in the current directional regime.


HOW TO USE IT

Use the map as a context filter alongside your own analysis:

• Bullish indicates persistent positive directional structure.
• Bearish indicates persistent negative directional structure.
• Neutral indicates that directional strength is below the selected threshold.
• Compressed indicates volatility below its recent baseline.
• Expanding indicates volatility above its recent baseline.

The corridor can also provide visual context around the equilibrium line. Price moving outside the corridor does not, by itself, constitute a breakout or reversal signal.


INPUTS

Regime Engine

• Fast Length: Period of the faster EMA used in directional separation.
• Equilibrium Length: Period of the central EMA used for the corridor.
• Slope Lookback: Bars used to measure the equilibrium slope.
• Efficiency Length: Window used to compare net movement with total path movement.
• ATR Length: ATR period used for normalization and corridor width.
• Volatility Baseline: Window used for the rolling ATR baseline.
• Spread Weight and Slope Weight: Relative contribution of both directional components.

Classification

• Trend Threshold: Minimum absolute directional score required for a bullish or bearish regime.
• Compression Ratio: ATR-to-baseline ratio below which volatility is classified as compressed.
• Expansion Ratio: ATR-to-baseline ratio above which volatility is classified as expanding.

Regime Corridor

• Inner Zone ATR and Outer Zone ATR: Width of the two corridor layers.
• Show Outer Context Zone: Displays or hides the lighter outer layer.
• Show Equilibrium Line: Displays or hides the central line.
• Color Transition Bars: Controls how quickly a new regime color reaches full intensity. This affects presentation only.
• Tint Candles By Regime and Tint Chart Background: Optional visual context, disabled by default.

State Changes

• Label Confirmation Bars: Number of persistent state bars required before a label is displayed.
• Same-Label Minimum Distance: Minimum distance between labels of the same type.
• Neutral labels are optional and disabled by default.


ALERTS

The script provides five alert conditions:

• Market Regime Changed
• Bullish Regime Started
• Bearish Regime Started
• Compression Started
• Expansion Started

Alerts are confirmed on bar close by default. Label confirmation is separate from alert timing, so the optional label delay does not delay the corresponding regime alert.


REALTIME AND REPAINTING BEHAVIOR

The script does not use higher-timeframe requests, future data, offsets into the future, or lookahead logic. Historical classifications are calculated from information available on each bar.

On an open realtime bar, price, ATR, the corridor, and the displayed regime can change as new ticks arrive. With Confirm Alerts On Bar Close enabled, alerts trigger only after the bar is confirmed. This is the recommended setting for stable alert behavior.


LIMITATIONS

• This is an indicator, not a strategy or automated trading system.
• It does not predict future price movement.
• Bullish and bearish states are contextual classifications, not trade recommendations.
• The corridor provides volatility-scaled context and does not define fixed support or resistance levels.
• Results depend on symbol, timeframe, data quality, and selected parameters.
• Very short history can produce a warmup state until all calculations are available.
• Non-standard chart types use synthetic chart prices and may behave differently from standard OHLC charts.


ORIGINALITY

This script is an original implementation. Its distinctive contribution is the combination of an ATR-normalized directional engine, path-efficiency weighting, separate volatility classification, asymmetric regime-context zones, and a compact state dashboard in one causal chart overlay.

免責聲明

這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。