On Balance Volume MTF
- Indicators
- Version: 1.20
- Activations: 10
The OBV MTF is an Enterprise-grade On-Balance Volume indicator that transforms standard OBV into a complete trading system. It combines gradient-aware momentum analysis, divergence detection, multi-timeframe alignment, and dynamic customisable midpoint-filtering in a single intuitive professional volume analysis tool.
Core Features
1. 5-State Momentum Engine
-
Aqua (Strong Bullish): OBV slope rising with positive acceleration
-
SteelBlue (Weak Bullish): OBV rising but losing momentum
-
Gray (Neutral): OBV flat or consolidating within hysteresis band
-
DeepPink (Weak Bearish): OBV falling but losing downward momentum
-
Magenta (Strong Bearish): OBV slope falling with negative acceleration
This state machine uses hysteresis to prevent whipsaw and acceleration as a second derivative indicator. User can change these colours.
2. Dynamic Divergence Detection
Detects both regular and hidden divergences with a multi-factor scoring system (0-100):
-
Regular Bearish: Price makes higher high, OBV makes lower high
-
Regular Bullish: Price makes lower low, OBV makes higher low
-
Hidden Bearish: Price makes lower high, OBV makes higher high
-
Hidden Bullish: Price makes higher low, OBV makes lower low
Scoring factors:
-
Bar distance (12-50 bars ideal)
-
Volume confirmation
-
Slope steepness comparison
3. Native Multi-Timeframe Panel
Displays OBV direction on 3 user-selectable timeframes:
-
Shows BULL (▲ Aqua) when OBV rising
-
Shows BEAR (▼ Magenta) when OBV falling
-
Background color indicates confluence:
-
Dark Green: All 3 timeframes bullish
-
Dark Red: All 3 timeframes bearish
-
Dark Olive Green: Bullish bias (2 of 3)
-
Dark Violet: Bearish bias (2 of 3)
-
4. Dynamic Rolling Midpoint
Calculates the midpoint of OBV's range over a user-defined period:
-
Midpoint = (Highest OBV + Lowest OBV) / 2
-
Provides a dynamic reference line (not static overbought/oversold)
-
Visual gold line on the indicator window
5. Filter System
Three filter modes using the dynamic midpoint:
-
FILTER_NONE: All signals allowed
-
FILTER_TREND: Buy signals allowed above midpoint, sell signals allowed below midpoint
-
FILTER_MEAN_REVERSION: Sell signals allowed above midpoint, buy signals allowed below midpoint
Filters apply to both momentum arrows and divergence signals.
6. Momentum & Divergence Signals
Momentum Signals (Buffers 2 & 3):
-
▲ Aqua Arrow: OBV transitions from Neutral to Strong Bullish
-
▼ Magenta Arrow: OBV transitions from Neutral to Strong Bearish
Divergence Signals (Buffers 4 & 5):
-
▲ Lime Green: Bullish divergence detected (regular or hidden)
-
▼ Orange Red: Bearish divergence detected (regular or hidden)
Technical Specifications
Buffers index (for EA integration) and other specifications available upon purchase and request.
Input Parameters
-
InpSmoothingPeriod (default: 5) - EMA smoothing period
-
InpHysteresis (default: 0.15) - Deadband threshold
-
InpMidpointPeriod (default: 50) - Lookback for midpoint
-
InpFilterMode (default: FILTER_NONE) - Filter selection
-
InpMTF1, InpMTF2, InpMTF3 - MTF timeframes
-
InpMTFRefreshMins (default: 5) - MTF update interval
-
MinDivScore (default: 70.0) - Minimum divergence confidence
COMMON QUESTIONS & ANSWERS
Q: What timeframes does this indicator work best on?
A: The indicator works on all timeframes. Optimal performance:
-
Scalping (M1-M5): SmoothPeriod=3, Hysteresis=0.10, RightBars=1
-
Day Trading (M15-H1): SmoothPeriod=5, Hysteresis=0.15, RightBars=3
-
Swing Trading (H4-D1): SmoothPeriod=8, Hysteresis=0.20, RightBars=5
Q: Why does the MTF panel sometimes show "LOADING"?
A: The panel needs to load data from multiple timeframes. It will display "LOADING" until 5+ bars are available on all selected timeframes. This typically resolves within 30 seconds.
Q: What is the difference between regular and hidden divergence?
A:
-
Regular Divergence: Signals potential reversal (Price and OBV move in opposite directions)
-
Hidden Divergence: Signals trend continuation (Price and OBV move in same direction but OBV shows momentum weakening)
Both types are displayed with the same arrow colors but can be distinguished by the price pattern.
Q: What does the gold midpoint line represent?
A: The gold line is the dynamic midpoint of OBV's range over the lookback period (default 50 bars). It represents the center of recent volume distribution, calculated as (Highest OBV + Lowest OBV) / 2. It is NOT a static overbought/oversold level.
Q: How do filters work with the midpoint?
A:
-
FILTER_TREND: Only buy signals appear when OBV > midpoint; only sell signals appear when OBV < midpoint
-
FILTER_MEAN_REVERSION: Only sell signals appear when OBV > midpoint; only buy signals appear when OBV < midpoint
-
FILTER_NONE: All signals appear regardless of midpoint position
Q: Can I use this indicator in an Expert Advisor?
A: Yes. All buffers are accessible via iCustom() calls. Buffer 0 contains raw OBV values, Buffer 2 contains buy signals, Buffer 3 contains sell signals, Buffer 4 contains bullish divergences, and Buffer 5 contains bearish divergences.
Q: Why does the indicator show magenta when I'm on a timeframe where OBV is bearish?
A: The MTF panel displays the direction of OBV on each selected timeframe, not the main indicator's color. If OBV is falling on that timeframe, it shows BEAR (Magenta). The main OBV line on your current chart follows the 5-state coloring based on slope and acceleration.
Q: How often does the MTF panel update?
A: The panel updates based on InpMTFRefreshMins (default 5 minutes). This prevents excessive CPU usage from recalculating on every tick. You can reduce this to 1 minute for more frequent updates or increase to 15-30 minutes for better performance.
Q: What is the difference between Weak and Strong states?
A:
-
Strong states (Aqua/Magenta): Slope is moving in direction WITH acceleration (momentum is increasing)
-
Weak states (SteelBlue/DeepPink): Slope is moving in direction BUT acceleration is opposite (momentum is decreasing)
Weak states often precede reversals while strong states indicate continuation.
Q: Can I hide the gold midpoint line?
A: Yes. Set InpShowMidpoint = false in the input parameters.
Q: Why do I see arrows that don't seem to match price action?
A: Arrows appear based on OBV behavior, not price alone. A buy arrow (Aqua) appears when OBV transitions from Neutral to Strong Bullish regardless of price. This indicates underlying buying pressure that may not yet be reflected in price.
Q: What does the divergence score mean?
A: The score (0-100) indicates confidence in the divergence:
-
85-100: Excellent quality (strong signals)
-
70-84: Good quality (valid trades)
-
60-69: Average quality (use caution)
-
Below 60: Poor quality (filtered out)
Scores are based on volume, momentum, and bar distance factors.
Q: How do I know if a divergence is confirmed?
A: The indicator uses a Price Action Guard: price must move in the divergence direction within PivotRightBars bars after the divergence appears. This confirmation reduces false signals.
Q: Does this work in Strategy Tester?
A: Yes. The MTF panel updates on each new bar in the tester (not on every tick) for optimal performance. All signals are generated correctly.
Q: What is the hysteresis band and why is it important?
A: The hysteresis band (InpHysteresis) creates a deadzone around neutral that prevents rapid color changes in flat markets. This reduces false signals and whipsaw entries. Higher values (0.20+) work better in ranging markets; lower values (0.10-) work better in trending markets.
For questions or support:
-
Email: Ebrah.Ssali@Nnanda.com
-
MQL5 Community: Direct messages
⚠️ DISCLAIMER
This indicator is provided "as is" for informational and educational purposes only. Past performance does not guarantee future results. Always backtest thoroughly and demo trade before using with real money. Trading involves substantial risk of loss.
KEYWORDS
OBV, On-Balance Volume, Divergence, Momentum, MTF, Multi-Timeframe, Volume Analysis, Trading Indicator, MT5, Technical Analysis, Hidden Divergence, Regular Divergence, Trend Following, Mean Reversion, Professional Trading Tool
