OPEN-SOURCE SCRIPT
Fractal Regime Engine (FRPE)

🚀 Fractal Regime Engine (FRPE)
The FRPE (Fractal Regime Engine) is an advanced, quantitative market regime oscillator designed to identify structural transitions between trend expansion, mean reversion compression, and neutral market equilibrium in real time. Built on a multi-scale fractal scaling framework, volatility-normalized logarithmic relationships, and adaptive statistical compression, this indicator reconstructs market behavior through regime dynamics rather than price direction alone.
Unlike conventional momentum oscillators that rely on lagging price derivatives, FRPE models the *structural complexity of market behavior* by comparing fractal scaling differences across multiple time horizons. This allows the detection of regime shifts that occur before they become visually apparent on price charts.
The result is a bounded, adaptive regime signal that clearly distinguishes when the market is expanding directionally, compressing into equilibrium, or transitioning between structural phases of uncertainty.
💡 Key Features
🧠 Multi-Scale Fractal Engine:
FRPE evaluates market structure across short, mid, and long-term windows simultaneously. By measuring fractal scaling divergence between these timeframes, the system isolates structural drift in market behavior rather than simple price movement.
📊 Fractal Drift Model:
The core signal is derived from the differential relationship between short-term and long-term fractal scaling behavior. This creates a robust measure of regime imbalance that reflects the underlying geometry of market activity.
🔬 Volatility-Normalized Log Scaling:
Price range behavior is normalized against ATR-based volatility scaling using logarithmic transformation. This ensures that the signal remains consistent across different asset classes and volatility regimes.
⚡ Adaptive Oscillator Compression:
All raw outputs are transformed into a bounded oscillator (-100 to +100) using dynamic scaling logic. This enables consistent interpretation across all market conditions without recalibration.
🛡️ Percentile-Based Dynamic Thresholds:
Instead of fixed levels, FRPE uses rolling percentile bands to define regime boundaries. This ensures that signal sensitivity adapts automatically to changing market environments.
📉 Three-State Regime Classification:
FRPE categorizes market behavior into three structural phases:
* Expansion Regime (Trend Continuation / Directional Imbalance)
* Compression Regime (Mean Reversion / Liquidity Equilibrium)
* Transition Regime (Structural Uncertainty / Regime Shift Zone)
🔬 Mathematical Logic and Structure
FRPE is built on a multi-layer fractal decomposition model that transforms raw market data into a structured regime oscillator.
The process begins by calculating a fractal scaling proxy based on the logarithmic relationship between price range expansion and volatility-adjusted ATR scaling. This creates a normalized measure of how efficiently price is expanding relative to its underlying volatility structure.
To capture structural differences across time horizons, the system computes fractal scaling values across short, mid, and long windows. The divergence between short-term and long-term behavior forms the core “fractal drift” signal, which represents directional structural imbalance in market dynamics.
This drift signal is then amplified and normalized into a bounded oscillator space (-100 to +100), allowing direct interpretation of regime intensity. Positive values indicate structural expansion and trending behavior, while negative values indicate compression and mean-reverting pressure.
To eliminate noise and microstructure distortion, the signal is smoothed using exponential moving averaging, ensuring that only statistically relevant regime transitions are preserved.
Finally, adaptive percentile-based thresholds dynamically define regime boundaries based on recent historical distribution. This removes dependency on static parameters and ensures robustness across different volatility environments.
In essence, FRPE does not track price direction. It reconstructs the *structural evolution of market complexity across time scales* and translates it into a unified regime map of expansion, compression, and transition.
🛠️ How to Use
1. Expansion Regime (Positive Extremes):
Indicates strong directional structure and increasing trend persistence. Breakout continuation strategies are statistically favored.
2. Compression Regime (Negative Extremes):
Represents equilibrium or absorption phases where mean reversion behavior dominates. Range-bound strategies tend to perform better.
3. Transition Regime (Neutral Zone):
Signals structural uncertainty and regime instability. Market conditions are non-directional and require caution.
🎛️ Settings
* Short Window (10): High-frequency structural sensitivity
* Mid Window (30): Core regime stability filter
* Long Window (100): Macro structural reference baseline
* Smoothing Length (5): Signal stabilization layer
📌 Credits and Origins
FRPE is engineered by gunebak4n as a structural market regime framework built on multi-timeframe fractal scaling dynamics, volatility-normalized logarithmic relationships, and adaptive statistical compression. The model is designed to move beyond traditional momentum-based oscillators and instead reconstruct underlying market behavior through regime transitions driven by fractal divergence across time horizons.
The model is optimized for discretionary traders, quantitative analysts, and systematic trading workflows that prioritize regime awareness over directional prediction.
⚠️ Disclaimer
All outputs generated by FRPE are probabilistic and non-deterministic. This indicator does not predict market direction or guarantee outcomes. It is a structural analysis tool intended to support decision-making under uncertainty. Proper risk management remains essential at all times.
The FRPE (Fractal Regime Engine) is an advanced, quantitative market regime oscillator designed to identify structural transitions between trend expansion, mean reversion compression, and neutral market equilibrium in real time. Built on a multi-scale fractal scaling framework, volatility-normalized logarithmic relationships, and adaptive statistical compression, this indicator reconstructs market behavior through regime dynamics rather than price direction alone.
Unlike conventional momentum oscillators that rely on lagging price derivatives, FRPE models the *structural complexity of market behavior* by comparing fractal scaling differences across multiple time horizons. This allows the detection of regime shifts that occur before they become visually apparent on price charts.
The result is a bounded, adaptive regime signal that clearly distinguishes when the market is expanding directionally, compressing into equilibrium, or transitioning between structural phases of uncertainty.
💡 Key Features
🧠 Multi-Scale Fractal Engine:
FRPE evaluates market structure across short, mid, and long-term windows simultaneously. By measuring fractal scaling divergence between these timeframes, the system isolates structural drift in market behavior rather than simple price movement.
📊 Fractal Drift Model:
The core signal is derived from the differential relationship between short-term and long-term fractal scaling behavior. This creates a robust measure of regime imbalance that reflects the underlying geometry of market activity.
🔬 Volatility-Normalized Log Scaling:
Price range behavior is normalized against ATR-based volatility scaling using logarithmic transformation. This ensures that the signal remains consistent across different asset classes and volatility regimes.
⚡ Adaptive Oscillator Compression:
All raw outputs are transformed into a bounded oscillator (-100 to +100) using dynamic scaling logic. This enables consistent interpretation across all market conditions without recalibration.
🛡️ Percentile-Based Dynamic Thresholds:
Instead of fixed levels, FRPE uses rolling percentile bands to define regime boundaries. This ensures that signal sensitivity adapts automatically to changing market environments.
📉 Three-State Regime Classification:
FRPE categorizes market behavior into three structural phases:
* Expansion Regime (Trend Continuation / Directional Imbalance)
* Compression Regime (Mean Reversion / Liquidity Equilibrium)
* Transition Regime (Structural Uncertainty / Regime Shift Zone)
🔬 Mathematical Logic and Structure
FRPE is built on a multi-layer fractal decomposition model that transforms raw market data into a structured regime oscillator.
The process begins by calculating a fractal scaling proxy based on the logarithmic relationship between price range expansion and volatility-adjusted ATR scaling. This creates a normalized measure of how efficiently price is expanding relative to its underlying volatility structure.
To capture structural differences across time horizons, the system computes fractal scaling values across short, mid, and long windows. The divergence between short-term and long-term behavior forms the core “fractal drift” signal, which represents directional structural imbalance in market dynamics.
This drift signal is then amplified and normalized into a bounded oscillator space (-100 to +100), allowing direct interpretation of regime intensity. Positive values indicate structural expansion and trending behavior, while negative values indicate compression and mean-reverting pressure.
To eliminate noise and microstructure distortion, the signal is smoothed using exponential moving averaging, ensuring that only statistically relevant regime transitions are preserved.
Finally, adaptive percentile-based thresholds dynamically define regime boundaries based on recent historical distribution. This removes dependency on static parameters and ensures robustness across different volatility environments.
In essence, FRPE does not track price direction. It reconstructs the *structural evolution of market complexity across time scales* and translates it into a unified regime map of expansion, compression, and transition.
🛠️ How to Use
1. Expansion Regime (Positive Extremes):
Indicates strong directional structure and increasing trend persistence. Breakout continuation strategies are statistically favored.
2. Compression Regime (Negative Extremes):
Represents equilibrium or absorption phases where mean reversion behavior dominates. Range-bound strategies tend to perform better.
3. Transition Regime (Neutral Zone):
Signals structural uncertainty and regime instability. Market conditions are non-directional and require caution.
🎛️ Settings
* Short Window (10): High-frequency structural sensitivity
* Mid Window (30): Core regime stability filter
* Long Window (100): Macro structural reference baseline
* Smoothing Length (5): Signal stabilization layer
📌 Credits and Origins
FRPE is engineered by gunebak4n as a structural market regime framework built on multi-timeframe fractal scaling dynamics, volatility-normalized logarithmic relationships, and adaptive statistical compression. The model is designed to move beyond traditional momentum-based oscillators and instead reconstruct underlying market behavior through regime transitions driven by fractal divergence across time horizons.
The model is optimized for discretionary traders, quantitative analysts, and systematic trading workflows that prioritize regime awareness over directional prediction.
⚠️ Disclaimer
All outputs generated by FRPE are probabilistic and non-deterministic. This indicator does not predict market direction or guarantee outcomes. It is a structural analysis tool intended to support decision-making under uncertainty. Proper risk management remains essential at all times.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.