Oscillator Regime Suite
- 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.0
- Activations: 10
This indicator applies the convergence/divergence construction — fast moving average minus slow, with a signal line — to a volume-derived series rather than to price. Three sources are selectable: Cumulative Volume Delta, Force Index, and On Balance Volume.
Adaptive volatility bands are drawn over the result, and every completed bar is classified into one of five regime states. That state is exposed as a numeric buffer, so an Expert Advisor can read it directly.
Why the source matters
A standard MACD measures price momentum, which is largely visible in the candles above it. These three sources measure something else: whether volume was accumulating or distributing while that price move happened.
The three are not interchangeable, and one of the screenshots shows all three on the same chart with identical settings so the differences are visible side by side.
- Cumulative Volume Delta — cumulative signed volume, re-anchored at the start of each day, week or month. The anchor is what makes it a session measure rather than an all-time one.
- Force Index — the bar's price change multiplied by its volume, then smoothed. A separate quantity from the other two.
- On Balance Volume — cumulative signed volume running continuously from the start of history, with no reset.
CVD and OBV share a cumulative signed-volume basis and differ only by anchoring. Set the CVD anchor to continuous and the two produce the same series, which is a useful check that both code paths agree.
The five regime states
Each completed bar is classified by where the histogram sits relative to the bands, and whether it is still expanding:
- Strong bullish — above the upper band and still expanding. Buffer value +2
- Weak bullish — above the upper band but fading. Buffer value +1
- Neutral — inside the bands. Buffer value 0
- Weak bearish — below the lower band but easing. Buffer value −1
- Strong bearish — below the lower band and still expanding. Buffer value −2
A band breach on its own does not say whether a move still has strength behind it. The direction of the histogram is what separates a move that is still building from one that has begun to fade, and that is the distinction the five states encode.
Tuning how selective the classification is
The bands are a standard deviation around a moving average, so they widen when activity rises and contract when it falls. Two inputs control how often the states change.
Bands period sets the window. Apply bands to signal line chooses whether they are measured over the signal or over the histogram itself. Two screenshots show the difference: at the defaults the states cycle through a move, while with the bands taken over the histogram at a longer period the histogram stays inside them most of the time and colours only on genuine breakouts.
Neither setting is the correct one. It depends on whether you want the classification to track every swing or to mark only the extremes.
Reading it from an Expert Advisor
The regime bias is buffer 6, not buffer 5. Buffer 1 holds the histogram's colour index and buffer 5 backs a hidden plot, so the data buffers are not numbered consecutively with the visible plots. This catches people out, which is why it is stated plainly here.
int h = iCustom(_Symbol, _Period, "OscillatorRegimeSuite"); double bias[]; ArraySetAsSeries(bias, true); CopyBuffer(h, 6, 0, 100, bias); // +2, +1, 0, -1 or -2
- 0 — histogram
- 1 — histogram colour index
- 2 — signal line
- 3 — upper band
- 4 — lower band
- 5 — plot placeholder
- 6 — regime bias, the EA-facing output
Buffers 7 and 8 hold the fast and slow moving averages and are used internally. They are not part of the documented interface.
One screenshot shows the Data Window with these values labelled against a single bar, alongside the built-in MACD on the same chart for comparison.
Inputs
- Source series — Cumulative Volume Delta, Force Index, or On Balance Volume
- Applied volume — tick volume or real volume
- CVD anchor — continuous, daily, weekly or monthly; applies to the CVD source only
- Force Index smoothing — period and method, applied to the Force source only; 13 and simple by default
- Fast and slow MA — period and method for each; 12 and 26, both exponential by default
- Signal MA — period and method; 9 and simple by default
- Enable bands and regime classification — off leaves a plain convergence/divergence oscillator with no states
- Apply bands to signal line — on by default; off measures them over the histogram instead
- Bands period and deviation multiplier — 20 and 1.618 by default
What the screenshots show
- All three sources on one chart — Bitcoin weekly, identical settings, with the built-in MACD at the bottom as a control. The three volume series differ from each other and from price momentum.
- The five states across a turn — EURGBP H4, where the progression from strong bearish through neutral to strong bullish and back is legible bar by bar.
- The Data Window — every buffer labelled on a single bar, with the regime bias reading −2.00, next to the built-in MACD's two unlabelled values.
- A sharp move on USDJPY hourly — the volume series turned negative while the price MACD was still positive. One window on one instrument; see the note below on what this does and does not show.
- Gold on M15 with a daily anchor — CVD resetting each session, alongside a much slower OBV instance on the same chart.
- Silver H4 at 50/200/20 and US30 daily at 34/89/13 — the periods are inputs, and the classification holds at settings well away from the defaults.
- A selective configuration — GBPUSD hourly with the bands over the histogram at a longer period, where most bars stay neutral and only clear breakouts are coloured.
- The anchor notice — a daily anchor requested on a daily chart, where it would reset every bar. The indicator says so in the Experts log and falls back to a continuous series.
- The inputs dialog — every setting, with the indicator visible behind it.
Calculation behaviour
Closed-bar values are final. The forming bar updates until it closes and is recomputed on each tick rather than being frozen at first touch.
The cumulative sources are advanced one bar at a time from the previous bar's value, so reprocessing the forming bar cannot double-count its volume — a failure mode that makes a cumulative series drift upward without bound.
Nothing is drawn until the calculation has the history it requires. With the default periods that is 55 bars, and it rises if you lengthen the bands or use the Force source. Values are never computed from a partial window and then plotted as though they were complete.
An anchor that cannot work on the current timeframe — a daily reset on a daily chart, for instance, which would reset every bar — is reported in the Experts log and replaced with a continuous series. The pane's name changes to match, so the chart always states which series it is actually showing.
Notes
- Draws in a separate window with nine buffers, seven of them documented above.
- The bands are always taken over a simple moving average, whatever method is chosen for the signal line. This follows the usual convention for standard-deviation bands.
- Real volume is only available where your broker supplies it. Tick volume is the default and works everywhere.
- More than one instance can be attached to the same chart, with different sources or different periods.
- 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. Where a screenshot shows a volume series turning before price did, that is one window on one instrument, chosen because it was interesting. It is not evidence that the series leads price, and establishing such a claim would require testing across many instruments and market conditions. No claim is made about performance.
| More tools from this developer I build 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. Two of the three sources here are also published on their own, free: Anchored Volume Delta with Adaptive Bands and Force Index with Adaptive Volatility Bands. Each plots one series with the bands but without the regime classification, and they are a good way to see whether the approach suits you before buying this. If you only want the On Balance Volume source with the five-state classification, OBVCD Pro does exactly that as a single-source indicator. 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, MT5/MQL5 developer.
