OPEN-SOURCE SCRIPT
已更新

Multi-Factor Regime Engine Pro [MarkitTick]

6 125
💡 This indicator represents a robust framework designed to quantify market regimes by analyzing an array of price action, volatility, and momentum metrics. By synthesizing ten distinct market features into a unified confidence score, it dynamically adjusts its threshold bands, providing a highly adaptive approach to trend identification on any standard chart.

✨ Originality and Utility
Standard trend-following tools often rely on static lookback periods and fixed multipliers, which can lead to delayed signals during sudden market shifts or excessive false signals during consolidation. This indicator diverges from traditional methods by introducing a dynamic, feature-engineered confidence score. Instead of relying on a single data point like closing price or standard volatility, it aggregates inputs from momentum oscillators, directional movement indices, volume profiles, and standard deviation bands. This multi-dimensional analysis allows the indicator's bands to compress during high-confidence trends and expand during uncertain, low-confidence environments, offering a highly responsive and adaptive utility for modern chart analysis. Furthermore, it incorporates strict internal safeguards to prohibit execution on non-standard charts, ensuring the integrity of the data and preventing repainting vulnerabilities.

🔬 Methodology and Concepts
● The Feature Engineering Engine
The core of this indicator is built upon extracting ten distinct normalized features from the market data, evaluating multiple dimensions of price action simultaneously:
  • Momentum Normalization: Utilizes relative strength metrics, centered and scaled, to gauge underlying momentum bias without relying on absolute thresholds.
  • Directional Strength: Analyzes directional movement indices to quantify the strength of the current trajectory, applying directional penalties when negative movement overpowers positive movement.
  • Moving Average Distances: Measures the current price relative to fast and slow moving averages, standardizing the distance using the Average True Range to identify structural overextension.
  • Rate of Change Standardization: Normalizes the rate of change against its own rolling standard deviation to detect statistical anomalies in speed and acceleration.
  • Standard Deviation Extremes: Evaluates the position of the price relative to upper and lower Bollinger Bands, calculating the precise percentile of the close within the volatility envelope.
  • Volatility Stability: Compares short-term volatility against long-term volatility baselines to measure market stress and detect rapid expansions.
  • Volume Anomalies: Assesses current volume against its simple moving average, clamping the result to identify participation spikes that validate price movement.
  • Price Action Consistency: Calculates the ratio of bullish to bearish closes within the defined lookback period, serving as a raw footprint of buyer versus seller control.


● The Confidence Score Assembly
These standardized features are separated into distinct sub-components. A Directional Score identifies the probable path of the trend by weighting momentum and moving average slopes. A Quality Score measures the structural integrity of that trend by analyzing volume participation and volatility stability. These are mathematically combined to produce a Raw Confidence value. This raw output undergoes an adaptive smoothing process using a dynamic moving average, resulting in a highly stable, final Confidence Score bounded precisely between 0% and 100%.

● Adaptive Ratcheting Bands
The calculated Confidence Score directly influences the width of the trend bands. When the confidence is high, the internal multiplier decreases, tightening the bands closer to the price action to capture shifts quickly and protect accumulated distance. Conversely, when confidence is low, the bands expand to avoid noise and erratic whipsaws. The bands utilize a state-machine logic that only ratchets in the direction of the trend, acting as a trailing threshold that reacts to both price crosses and sudden regime shifts identified by extreme volatility spikes.

🎨 Visual Guide
● Heatmap Candles
  • The indicator actively repaints the chart candles based on a calculated mathematical "stress" metric.
  • Colors transition dynamically from a baseline trend color (Deep Sky Blue for bullish conditions, Radical Red for bearish conditions) to a bright orange "Regime Alert" color when underlying volatility spikes significantly.
  • Candle body opacity is heavily controlled by the alignment of the price action with the overall trend direction, fading to a darker tone during contrary movements or low-confidence pullbacks.


● ML Supertrend Band
  • Displayed as a prominent, solid line representing the adaptive trailing threshold on the chart.
  • This band is colored Deep Sky Blue during bullish market phases and Radical Red during bearish phases, updating in real-time as the state machine ratchets.


● Confidence Gradient Cloud
  • This visual element fills the spatial gap between the median price baseline and the trailing Supertrend band.
  • The exact opacity and gradient of this cloud are mapped directly to the Confidence Score. A highly opaque, solid cloud represents high confidence, while a highly transparent, fading cloud visually indicates low confidence and potential market transition.


● Visual Labels
  • Small directional visual markers appear directly above or below the price action when a trend flip occurs.
  • These labels display an arrow alongside a precise percentage value, representing the exact calculated Confidence Score at the moment the signal was generated.


● Info Table
  • Located statically in the top right corner, this dashboard displays crucial real-time internal metrics.
  • It includes the current trend direction, a visual text-based progress bar for the Confidence Score, the live Adaptive Multiplier value adjusting in real-time, the selected Model configuration, and a dynamic text alert that triggers during active Regime Shifts.


📖 How to Use
● Trend Identification
Observe the dominant color of the ML Supertrend Band and the Confidence Gradient Cloud. Deep Sky Blue strongly indicates a bullish environment, while Radical Red suggests a bearish environment. The visibility and thickness of the cloud serve as your primary visual gauge of the trend's structural health.

● Interpreting the Confidence Metric
Monitor the Confidence Score inside the Info Table or at signal generation. A high percentage (e.g., above 70%) suggests that multiple underlying market factors (volume, momentum, standard deviation) are in full agreement with the current directional bias. A rapidly dropping confidence score often precedes a period of choppy consolidation or warns of a potential reversal, allowing for tighter risk parameters.

● Reading Heatmap Candles for Shifts
When the standard colored candles begin transitioning toward the bright orange Regime Alert color, it indicates an abnormal spike in volatility combined with a directional momentum shift. This visually warns the user of a potential "Regime Shift" where the market is undergoing severe internal stress. These specific visual cues often signal an impending breakout from a range or a violent capitulation event.

⚙️ Inputs and Settings
● Model Configuration
  • Strategic Cycle Mode: Allows the choice between an "Auto" mode and a "Custom" mode. Auto mode dynamically selects the most mathematically optimal lookback lengths, thresholds, and weighting coefficients based purely on the current timeframe in seconds.
  • Strategic Cycle: When in custom mode, this determines the core lookback period for all volatility and momentum calculations. Smaller values drastically increase reactivity, while larger values provide smoother, long-term macroeconomic analysis.
  • Macro Trend Threshold: Sets the baseline mathematical width of the threshold bands. Higher values require significantly larger price movements to trigger a trend flip, reducing noise.
  • Prediction Weight: Controls the internal sensitivity of the bands to rapid changes in the Confidence Score, determining how aggressively the bands compress.


● Visual Settings & Colors
  • Dedicated toggles are provided to enable or disable the Confidence Labels, the Info Table, and the Heatmap Candles to keep the chart interface as clean as desired.
  • All core graphical colors, including the specific bands, gradient clouds, table text, and alert highlights, are fully customizable by the user via hex selection.


● Webhook Settings
  • The indicator is pre-configured to output detailed, formatted JSON payloads designed for external execution automation.
  • Users can securely define specific action strings for entering and closing both long and short positions directly within the settings menu, mapping exactly to their webhook parser logic.


🔍 Deconstruction of the Underlying Scientific and Academic Framework
● Multi-Variate Feature Standardization
The mathematical foundation of this tool relies heavily on statistical normalization techniques designed to process heterogeneous data. Financial time series data is notoriously non-stationary and spans vastly different numerical scales. To effectively combine disparate metrics like Volume (often measured in millions) and relative strength oscillators (strictly bounded between 0 and 100), the indicator employs rigorous Min-Max scaling and localized Z-score approximations. For instance, the rate of change is evaluated against its own rolling standard deviation over a defined period, successfully standardizing the momentum readout into a continuous, comparable spectrum bounded cleanly between -1.0 and 1.0.

● Linear Weighted Ensembles
The internal architecture utilizes a deterministic linear weighted model to synthesize the final output. By assigning highly specific fractional coefficients to directional features (like the exponential moving average slope and relative strength) and structural features (like Bollinger Band width extremes and volatility stability), the script constructs a singular composite index. This mirrors standard ensemble methodologies found in data science, where the consensus of multiple independent weak learners generates a stronger, more reliable predictive metric than any single indicator could achieve in isolation.

● Volatility-Adjusted State Machines
The adaptive threshold logic operates as a strict finite-state machine incorporating the Average True Range metric. The specific mathematical innovation lies in rendering the ATR multiplier as an inverse linear function of the composite confidence index. In quantitative terms, this produces a dynamically dampened volatility envelope. When the composite index approaches a maximum value indicating high convergence, the dampening factor aggressively compresses the envelope, mathematically acknowledging that high-conviction trends exhibit less erratic mean-reversion behavior and therefore require drastically tighter invalidation levels to preserve structural alpha.

⚠️ Disclaimer
All provided scripts and indicators are strictly for educational exploration and must not be interpreted as financial advice or a recommendation to execute trades. I expressly disclaim all liability for any financial losses or damages that may result, directly or indirectly, from the reliance on or application of these tools. Market participation carries inherent risk where past performance never guarantees future returns, leaving all investment decisions and due diligence solely at your own discretion.
發行說明
Optimized indicator

免責聲明

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