Skip to content

Free MT5 indicator

Supply & Demand Zones

Draws supply and demand zones from small base candles followed by a strong departure candle and tracks each zone as fresh, tested or broken.

Levelsv1.0MetaTrader 5 (MQL5) Compiles with 0 errors Non-repainting signals Alerts

What it does

FXP Supply & Demand finds the price areas where the market paused briefly and then left with force. A demand zone is a small base followed by a strong bullish candle; a supply zone is a small base followed by a strong bearish candle. Each zone is drawn as a rectangle that extends to the right and carries a label showing its state.

Zones start as fresh, become tested when price returns into them (the label counts the tests), and are broken when a candle closes through the far side.

How it works

  1. Volatility is measured with a 14-period ATR (Wilder smoothing).
  2. A departure candle has a body of at least 1.5 x ATR (default). Before it, the indicator counts up to 3 consecutive base candles whose bodies are at most 0.5 x ATR.
  3. Demand: the departure closes bullish and above the base high. The proximal (near) edge is the highest open or close of the base; the distal (far) edge is the lowest low of the base and departure candle.
  4. Supply: the departure closes bearish and below the base low. Proximal edge = lowest open or close of the base; distal edge = highest high of the base and departure.
  5. On each later closed candle: if the close goes beyond the distal edge, the zone is broken. Otherwise, if the wick reaches the proximal edge, the zone is tested; one visit counts as one test until price leaves the zone again.
  6. Only closed candles are evaluated, and only new bars are processed.

How to use it

Copy the .ex5 file into MQL5/Indicators and attach it to a chart.

Fresh zones are where many supply and demand traders look first, because the orders that caused the departure may not have been fully filled. Each test tends to weaken a zone. Higher-timeframe zones (H4, D1) can frame trades taken on lower timeframes. Treat zones as areas rather than exact prices, and compare them with classic support and resistance.

If too many zones appear, raise the departure multiple or lower the base body limit. Turning off overlap skipping shows every zone, including nested ones.

Settings

InputDefaultWhat it changes
Max base candles3Longer bases allowed when larger.
Base candle body at most (x ATR)0.5How quiet a base candle must be.
Departure candle body at least (x ATR)1.5How strong the move away must be.
ATR period14Volatility reference.
Skip zones overlapping a live zonetrueAvoids duplicate zones.
History bars to analyse2000Look-back for drawing.
Broken zonesKeep as greyGrey out or delete.
Max live zones per side / max broken6 / 10Caps on drawn zones.
Extend live zones right by N bars10Projection beyond the last candle.
Zone colorsby stateFresh, tested and broken colors.
Show zone state labelstrueText labels on each zone.
Alert on new zone / first testfalseOne alert per bar.

Limitations

  • The rules are a mechanical approximation; discretionary traders draw zones with more judgment and will disagree with some of them.
  • Wide zones mean wide stops. Check the distance in pips with a pip calculator before planning a trade.
  • Zones are only known after the departure candle closes.
  • A zone can fail on the first test. Always define your risk in advance. Trading involves substantial risk of loss.

Key inputs

Key inputs of Supply & Demand Zones
InputDefaultDescription
Max base candles3Up to this many small candles can form the base.
Base candle body at most (x ATR)0.5A base candle's body must be small relative to the ATR.
Departure candle body at least (x ATR)1.5The candle leaving the base must be large relative to the ATR.
Skip zones overlapping a live zone of the same typetruePrevents stacked duplicate zones.
Broken zonesKeep as grey rectangleGrey out or delete zones once price closes through them.
Max live zones per side6Oldest live zones are removed beyond this count.
Alert on new zone / first test (once per bar)falseAlerts on zone creation and on the first return into a fresh zone.

Educational tools, not advice. Indicators and Expert Advisors describe price; they do not predict it, and past behaviour does not guarantee future results. Test everything on a demo account first and never risk money you cannot afford to lose. See our disclaimer.

Keep exploring

Related mt5 indicators