OPEN-SOURCE SCRIPT
Mean Reversion & Momentum Hybrid | D_QUANT

📌 Mean Reversion & Momentum Hybrid | D_QUANT
📖 Description:
This indicator combines mean reversion logic, volatility filtering, and percentile-based momentum to deliver clear, context-aware buy/sell signals designed for trend-following and contrarian setups.
At its core, it merges:
All tied together with a dynamic gradient-style oscillator that visualizes signal strength and persistence over time — making it easy to track high-conviction setups.
Signals only trigger when all three core components align, filtering out noise and emphasizing high-probability turning points or trend continuations.
⚙️ Methodology Overview:
Bollinger Bands % (BB%):
Price is measured as a percentage between upper and lower Bollinger Bands (based on OHLC4). Entries are only considered when price exceeds custom BB% thresholds — emphasizing market extremes.
Volatility-Based Trend Filter (RMA + ATR):
A smoothed RMA baseline is paired with ATR to define trend bias. This ensures signals only occur when price deviates meaningfully beyond recent volatility.
Percentile Momentum Model (75th/25th Rank):
Price is compared against its rolling 75th and 25th percentile. If price breaks these statistical boundaries (adjusted by ATR), it triggers a directional momentum condition.
Signal Consensus Engine:
All three layers must agree — BB% condition, trend filter, and percentile momentum — before a buy or sell signal is plotted.
Gradient Oscillator Visualization:
Signals appear as a fading oscillator line with a gradient-filled area beneath it. The color intensity represents how “fresh” or “strong” the signal is, fading over time if not reconfirmed, offering both clarity and signal aging at a glance.
🔧 User Inputs:
🧠 Core Settings:
📊 BB% Thresholds:
🔍 Trend Filter Parameters:
⚡️ Momentum Parameters:
🎨 Visualization:
🧪 Use Case:
This indicator works well across all assets for trend identification. It is particularly effective when used on higher timeframes (e.g. 12H, 1D,2D) to capture mean reversion bounces or confirm breakouts backed by percentile momentum and volatility expansion.
⚠️ Notes:
This is not financial advice. Use in combination with proper risk management and confluence from other tools.
📖 Description:
This indicator combines mean reversion logic, volatility filtering, and percentile-based momentum to deliver clear, context-aware buy/sell signals designed for trend-following and contrarian setups.
At its core, it merges:
- A Bollinger Band % Positioning Model (BB%)
- A 75th/25th Percentile Momentum System
- A Volatility-Adjusted Trend Filter using RMA + ATR
All tied together with a dynamic gradient-style oscillator that visualizes signal strength and persistence over time — making it easy to track high-conviction setups.
Signals only trigger when all three core components align, filtering out noise and emphasizing high-probability turning points or trend continuations.
⚙️ Methodology Overview:
Bollinger Bands % (BB%):
Price is measured as a percentage between upper and lower Bollinger Bands (based on OHLC4). Entries are only considered when price exceeds custom BB% thresholds — emphasizing market extremes.
Volatility-Based Trend Filter (RMA + ATR):
A smoothed RMA baseline is paired with ATR to define trend bias. This ensures signals only occur when price deviates meaningfully beyond recent volatility.
Percentile Momentum Model (75th/25th Rank):
Price is compared against its rolling 75th and 25th percentile. If price breaks these statistical boundaries (adjusted by ATR), it triggers a directional momentum condition.
Signal Consensus Engine:
All three layers must agree — BB% condition, trend filter, and percentile momentum — before a buy or sell signal is plotted.
Gradient Oscillator Visualization:
Signals appear as a fading oscillator line with a gradient-filled area beneath it. The color intensity represents how “fresh” or “strong” the signal is, fading over time if not reconfirmed, offering both clarity and signal aging at a glance.
🔧 User Inputs:
🧠 Core Settings:
- Source: Select the price input (default: close)
- Bollinger Bands Length: Period for BB basis and deviation
- Bollinger Bands Multiplier: Width of the bands
- Minimum BB Width (% of Price): Prevents signals during low-volatility chop
📊 BB% Thresholds:
- BB% Long Threshold (L): Minimum %B to consider a long
- BB% Short Threshold (S): Maximum %B to consider a short
🔍 Trend Filter Parameters:
- RMA Length: Period for the smoothed trend baseline
- ATR Length: Lookback for ATR in trend deviation filter
⚡️ Momentum Parameters:
- Momentum Length: Period for percentile momentum calculation
- Mult_75 / Mult_25: ATR-adjusted thresholds for breakout above/below percentile levels
🎨 Visualization:
- Bar Coloring: Highlights candles during active signals
- Background Coloring: Optional background shading for signals
- Show Oscillator Plot: Toggle the gradient-style oscillator
🧪 Use Case:
This indicator works well across all assets for trend identification. It is particularly effective when used on higher timeframes (e.g. 12H, 1D,2D) to capture mean reversion bounces or confirm breakouts backed by percentile momentum and volatility expansion.
⚠️ Notes:
This is not financial advice. Use in combination with proper risk management and confluence from other tools.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.