Loading…

Range Expansion Index

A trend can keep making new highs while the individual bars driving it get smaller - the move is still going, but it has stopped expanding, which is often the early tell that momentum is fading before price itself turns. Range Expansion Index measures exactly that: for each bar in the lookback window it compares the current high and low against the same bar two periods back, sums that net change across the window, and normalises it against the largest single two-bar range change over the same window. The result is bounded to -100/+100, with DeMark's traditional 60/-60 lines marking the levels usually read as overbought and oversold. A bar that gapped cleanly beyond both its two-bar-back and five-bar-back reference range on one side is excluded from the numerator - DeMark's own noise filter, carried through here - so a single outlier gap bar cannot swing the whole reading on its own. This implements DeMark's core range-expansion construction rather than claiming a byte-for-byte reproduction of every proprietary REI variant published under that name across different charting vendors, which differ slightly from each other in the exact gating logic. What is here is internally consistent, fully documented in the source, and produces the same exhaustion-on-non-expansion read the concept is known for. Notes and limitations - Needs InpPeriod + 6 bars of history to produce its first value, because each bar in the window also looks 5 bars further back for its own gap filter. - This is a momentum-exhaustion read, not a reversal signal on its own - a low reading says expansion has stopped, not that price will reverse immediately or by how much. - See the full description for the deliberate choice to document this as "DeMark-style" rather than claim an exact match to every published REI variant. - Non-repainting: every value is computed from fully closed bars only.

Indicator · MT4 · v1.0 · Free

About Range Expansion Index

Range Expansion Index is an indicator for MetaTrader 4. It has 1 setting, such as Period. MQL source code included.

Files in the download: RangeExpansionIndex.ex4, RangeExpansionIndex.mq4, RangeExpansionIndex.txt.

Settings

SettingDefaultWhat it does
Period8Lookback window, DeMark's standard is 8

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: Momentum · Oscillator · Trend · MT4 Indicator · MQL4 Source Code

MetaTrader 4 & 5 indicators · PolyMaria