Categories

Range Expansion Index Indicator MT4
This is a free, instant-download MT4 build of Tom DeMark's Range Expansion Index (REI), a bounded oscillator designed to flag when a market's range is genuinely expanding versus quietly grinding. Because it's a DeMark tool built on conditional logic rather than a simple average, it's worth understanding the actual rule set before you read the…
Download the Range Expansion Index Indicator MT4This is a free, instant-download MT4 build of Tom DeMark’s Range Expansion Index (REI), a bounded oscillator designed to flag when a market’s range is genuinely expanding versus quietly grinding. Because it’s a DeMark tool built on conditional logic rather than a simple average, it’s worth understanding the actual rule set before you read the plot as a signal.
What It Actually Calculates
REI is built from two rolling sums over an REI_Period-length window (default 8 bars), computed fresh for each bar going back through history:
- SubValue(i) — takes
diff1 = High[i] - High[i+2]anddiff2 = Low[i] - Low[i+2], then multiplies that sum by two conditional “zero” flags. The first flag requires that the bar two bars back closed below the closes seven and eight bars back, and that the current bar’s high is below the highs five and six bars back. The second flag runs the mirror-image test using lows. If either condition fails, the whole term is zeroed out for that bar — this is DeMark’s way of only crediting range expansion in the correct directional context. - AbsDailyValue(i) — the unconditional, always-positive version:
|High[i]-High[i+2]| + |Low[i]-Low[i+2]|.
The indicator sums SubValue and AbsDailyValue independently across the whole REI_Period window, then divides: REI = (sum of SubValue / sum of AbsDailyValue) * 100. Because SubValue can come out positive, negative, or zeroed, the ratio oscillates between roughly -100 and +100, plotted in a separate window with reference levels drawn at +60 and -60.
How to Read the Chart
Per the original DeMark methodology referenced in the indicator’s own comment block: a push above +60 followed by a drop back below +60 signals price weakness (a potential top). A push below -60 followed by a rise back above -60 signals price strength (a potential bottom). The key word is the round trip — DeMark’s method isn’t just “above 60 is overbought,” it’s the crossing back through the level that constitutes the actual signal.
Inputs
- REI_Period (default 8) — the number of bars used for both the SubValue and AbsDailyValue rolling sums. Smaller values make the oscillator faster and noisier; larger values smooth it out and delay signals.
Why the Conditional Gating Matters
The part that separates REI from a generic range indicator is the pair of zero-out flags inside SubValue(). On any given bar, if the bar two periods back doesn’t qualify as a genuine local extreme relative to bars five, six, seven, and eight periods back, that bar’s contribution to the bullish or bearish sum is multiplied by zero and effectively ignored — even if the raw high/low difference was large. This is what DeMark meant by “range expansion” rather than simple range: a big high-low swing only counts toward REI if it’s happening in a context where the market has actually broken out of its recent structure, not just printed a wide, directionless bar. It’s also why the two num_zero flags are calculated completely independently for the bullish and bearish sides of the formula — a single bar can contribute to neither, one, or (in edge cases) both sides of the SubValue sum, depending on which of the two directional tests it satisfies.
The indicator also sets SetIndexDrawBegin(0, REI_Period + 8), meaning it deliberately withholds plotting until enough history exists to fill the calculation’s full 8-bar lookback offsets (High/Low at i+8) on top of the REI_Period window itself.
Repaint Behavior
REI is non-repainting. The code follows the standard incremental MT4 pattern — it checks IndicatorCounted() and only recalculates bars that haven’t been processed yet, rather than rewriting the whole buffer on every tick. More importantly, both SubValue and AbsDailyValue only ever reference the bar being evaluated plus older bars (offsets of +2, +5, +6, +7, and +8 — all pointing further into the past, never forward). Since none of the inputs to the formula depend on bars that haven’t closed yet, a bar’s REI value is fixed the moment that bar closes and its lookback offsets are all historical.
Limitations
- The oscillator needs REI_Period + 8 bars of prior history before it starts plotting at all, so it will show gaps at the very start of thin history or brand-new symbols.
- The signal DeMark describes (cross above/below 60, then cross back) requires you to actually track the crossing sequence yourself — the indicator plots the raw REI value only, with no built-in arrows or alerts for the confirmed cross-back event.
- Like any range/momentum oscillator, REI can stay pinned near its extremes for extended periods in a strongly trending market, so treat +60/-60 as thresholds to watch for a reversal in the confirming pattern, not as a mechanical fade signal on their own.
- The indicator plots a single line with no separate arrows, colors, or on-chart labels marking a completed cross-back signal — you’re reading the raw ratio against the fixed +60/-60 reference levels yourself, which means it pairs well with a simple visual scan but has no built-in alert for the DeMark-specific trigger condition.
- REI_Period (default 8) — Number of bars used for both the conditional SubValue sum and the unconditional AbsDailyValue sum that make up the REI ratio.
FAQs About the MT4 Range Expansion Index Indicator MT4
Does the Range Expansion Index repaint?
No. It follows the standard IndicatorCounted() incremental calculation pattern and only ever references the current bar plus older, already-closed bars, so a bar’s value is locked in once that bar closes.
What does the REI_Period input actually control?
It sets the length of the rolling window (default 8 bars) used to sum both the conditional SubValue term and the unconditional AbsDailyValue term that make up the REI ratio.
What's the actual DeMark signal, not just the +60/-60 levels?
Per the indicator’s own header comment: a move above 60 that then drops back below 60 signals weakness, and a move below -60 that then rises back above -60 signals strength. The crossing back through the level is the signal, not simply touching it.
How is this different from a generic momentum oscillator like RSI or Stochastic?
REI uses DeMark’s conditional range-expansion logic — comparing today’s high/low against bars 2, 5, 6, 7, and 8 bars back with directional zero-out conditions — rather than a simple average of up/down closes, so its readings reflect qualified range expansion rather than raw price momentum.
What timeframes or pairs does REI suit best?
Not Specified in the code — there’s no built-in restriction. DeMark’s own default period of 8 bars is intraday-friendly, which is why it’s commonly run on shorter timeframes, but the code itself imposes no such limit.
