OBVCD Pro MT4
- Indicators
-
Narayanan Mohanan Mohanan Krishnan
MT5/MQL5 developer building Expert Advisors, custom indicators, and backtesting and validation tools. I focus on clean, well-documented, no-repaint code: closed-bar logic, validated buffers, proper handle and memory management. This is the engineering that separates a reliable tool from a fragile - Version: 1.20
- Activations: 10
OBVCD Pro is a momentum oscillator that applies convergence/divergence analysis to On-Balance Volume (OBV) instead of price, combining adaptive volatility bands with a 5-state regime classifier that can be read visually on the chart or consumed directly by an Expert Advisor.
Most classical oscillators analyse price alone. OBVCD Pro calculates convergence and divergence from cumulative volume flow, so it measures the participation behind a market move rather than only the movement itself. The result is reduced to a single regime value that is equally usable by a discretionary trader and an algorithmic system.
How it Works
On-Balance Volume (OBV) is calculated from the selected volume source. Tick Volume is used by default. Real Volume can be selected instead; MetaTrader 4 does not provide real volume, so the indicator reports this and stops rather than substituting something else silently.
A fast and a slow moving average are calculated over the OBV series (EMA 12 and EMA 26 by default). The difference between them forms the OBVCD Histogram. A Signal Line is then calculated over that histogram, using a 9-period SMA by default.
Upper and lower volatility bands are calculated from a 20-period standard deviation with a 1.618 deviation multiplier. The bands can be applied either to the Signal Line or directly to the Histogram.
Because the bands are based on standard deviation, they widen automatically during periods of high market activity and contract when activity falls. This allows one set of default settings to remain usable across very different instruments, instead of relying on fixed thresholds.
The 5-State Momentum Logic
The colour-coded histogram evaluates the position of momentum relative to the adaptive volatility bands and classifies every completed bar into one of five market states.
- Strong Bullish (Lime Green) — the histogram is above the upper band and bullish momentum continues to expand. Value: +2
- Weak Bullish (Light Green) — the histogram remains above the upper band, but bullish momentum is beginning to fade. Value: +1
- Consolidation (Gray) — the histogram is inside the bands, indicating a neutral or ranging market. Value: 0
- Weak Bearish (Orange) — the histogram is below the lower band, but selling pressure is beginning to ease. Value: −1
- Strong Bearish (Red) — the histogram is below the lower band and bearish momentum continues to expand. Value: −2
The key characteristic of this logic is the distinction between a move that is extended and one that is still expanding. A band breach on its own does not indicate that a move retains its strength; the direction of momentum is what separates continuation from exhaustion.
Algorithmic and EA Integration
The calculated market state is written to a dedicated buffer, so an Expert Advisor can read a finished value without inspecting colours and without re-implementing the internal logic.
Buffer 8 returns one of the following values:
- 2.0 = Strong Bullish
- 1.0 = Weak Bullish
- 0.0 = Consolidation
- −1.0 = Weak Bearish
- −2.0 = Strong Bearish
Obtain the indicator handle with iCustom(). Reading Shift 1 — the last fully completed bar — is recommended, as that value is final and will not change.
Public Buffer Map
- Buffer 0 — OBVCD Histogram (Neutral)
- Buffer 1 — OBVCD Histogram (Bull Strong)
- Buffer 2 — OBVCD Histogram (Bull Weak)
- Buffer 3 — OBVCD Histogram (Bear Strong)
- Buffer 4 — OBVCD Histogram (Bear Weak)
- Buffer 5 — Signal Line
- Buffer 6 — Upper Band
- Buffer 7 — Lower Band
- Buffer 8 — Regime Bias
Please note that MQL4 does not support colour index buffers, so the histogram requires five separate data buffers to render the 5 states (Buffers 0 to 4). The Regime Bias is therefore Buffer 8. Buffers 9 to 11 are used exclusively for internal calculations and are hidden from the Data Window.
Inputs
- Volume source — Tick Volume (default) or Real Volume where supported by the broker
- Fast moving average — period 12, EMA by default
- Slow moving average — period 26, EMA by default
- Signal moving average — period 9, SMA by default
- Supported MA methods — EMA, SMA, SMMA and LWMA
- Enable Bollinger Bands — enabled by default
- Bands applied to — Signal Line (default) or Histogram
- Bands period — 20
- Bands deviation — 1.618
With Bollinger Bands disabled, the indicator operates as a classical OBV convergence/divergence oscillator with a signal line, and the Regime Bias returns 0 on every bar.
What the screenshots show
- EURUSD, Monthly — Demonstrates long-term volume divergence analysis. The 5-state histogram tracks structural volume regime shifts across multi-year cycles.
- US30, Daily — Displays the application of custom parameters (Fast MA 50, Slow MA 200, Bands Period 20, Deviation 1.5). Extending the periods and narrowing the multiplier adapts the indicator to long-term index trends.
- XAUUSD, H1 — Demonstrates adaptive volatility band mechanics during price consolidation and subsequent breakdowns. Band contraction precedes directional movement.
- The Data Window (DXY, M5) — Confirms the accessibility of the Regime Bias buffer. The visual state maps directly to a discrete float value (e.g., 2.0000) for EA consumption.
- The inputs dialog (BTCUSD, Daily) — Confirms configuration options for moving average methods, applied volume, and Bollinger Bands logic.
Calculation behaviour
All values are calculated exclusively from completed historical data. Once a bar closes, its values do not change again. Only the currently forming bar updates as new ticks arrive.
For confirmed readings, Shift 1 should be used rather than Shift 0. The indicator uses no look-ahead data and does not repaint values after a bar has closed.
Notes
- Displayed in a separate indicator window.
- 8 visible plots.
- 13 indicator buffers.
- A semi-transparent histogram keeps the pane readable when used alongside other indicators.
- No external dependencies. Every value is calculated inside the indicator. It does not call any other indicator, so there are no handles to fail, nothing to install alongside it, and no dependency on the state of your standard indicator folder.
What this is and is not
This is a tool for technical analysis and for filtering market conditions. It is not a trading system, it produces no buy or sell signals, it gives no investment advice, and it does not open or manage positions.
It is descriptive rather than predictive, and no claim is made about its performance.
The free demo runs in the Strategy Tester. Put it on the instruments and timeframes you actually trade, and judge it against your own charts.
| More tools from this developer I build MT4/MT5 indicators and Expert Advisors with an emphasis on clean, documented, no-repaint code — closed-bar logic, validated buffers, and no dependencies on other indicators. The five-state regime classification here is part of the Oscillator Regime Suite, which applies it to volume-derived series rather than to price on the chart. Questions about the calculation, the buffers, or using this in your own EA? Send me a private message — I am happy to answer. |
Built and maintained by Narayanan Mohanan, MT4/MQL4 developer.
