Auto Supply And Demand Zones
The setup this looks for is a small base - a run of bars whose combined range is a small fraction of ATR - followed immediately by a departure at least some multiple of ATR away from it. The idea behind marking the base rather than the departure itself is that whatever orders fuelled the sudden move were most plausibly built while price sat in that narrow base, and any that were not filled are still assumed to be resting there. Both halves of the setup are measured against ATR rather than fixed pip values, specifically so the same settings mean roughly the same thing across different instruments and volatility regimes. A zone's on-chart label prints a strength ratio - departure size divided by base range - so a violent move off a razor-thin base, which is the more interesting setup, is visually distinct at a glance from a marginal one that only just cleared the threshold. A zone expires the first time a confirmed bar's wick trades all the way through it, on the reasoning that once the base has been fully revisited whatever resting interest was there has plausibly been absorbed; unlike some other zone indicators in this catalogue, an expired zone here is removed outright rather than fading to a neutral colour - there is no fade-and-keep option in this version. Because the base window is re-evaluated on every bar rather than only once per detected event, a sustained multi-bar impulse departing from a persistently tight run of prior bars can register more than one overlapping zone for what a trader would read as a single occurrence - each with a distinct anchor bar and its own strength figure. That is a known trade-off of the sliding-window approach, not a bug, and is worth knowing before relying on the zone count as a frequency measure. Notes and limitations - A zone only appears once the departure bar itself has closed - this marks a completed base-and-departure event for reference, it is not a live warning that a base is compressing while it is still forming. - Expired zones are deleted outright, with no fade-to-grey option in this version, unlike Fair Value Gaps and Order Blocks elsewhere in this catalogue. - The sliding base window is re-tested every bar rather than only once per event, so a single strong impulse off a persistently tight run of prior bars can produce more than one overlapping zone with different anchors - see the full description above. - The zone is drawn from the base's actual high-low range across all InpBaseBars bars, not from any single candle's body. - Both the base-tightness and departure-size tests depend on the same ATR reading; a period of unusually low volatility can make the departure threshold easy to clear even for a fairly ordinary move.
Indicator · MT4 · v1.0 · Free
About Auto Supply And Demand Zones
Auto Supply And Demand Zones is an indicator for MetaTrader 4 based on ATR. It can alert you with a pop-up, sound, email or push message. It has 8 settings, such as Alerts, Base bars and Base range atr fraction. MQL source code included.
Files in the download: SupplyDemandZones.ex4, SupplyDemandZones.mq4, SupplyDemandZones.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Alerts | true | Alert on a new zone (closed bar only) |
| Base bars | 3 | Bars forming the consolidation base |
| Base range atr fraction | 0.50 | Base range must be under this fraction of ATR |
| Departure atr multiple | 1.50 | Departure must be at least this many ATRs |
| Atr period | 14 | ATR period |
| Demand color | clrLimeGreen | Demand zone colour (departure was upward) |
| Supply color | clrOrangeRed | Supply zone colour (departure was downward) |
| Fill solid | true | Draw zones as solid rectangles |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Supply & Demand · ATR · Alerts · MT4 Indicator · MQL4 Source Code