Supply and Demand Zones MT4 Indicator.
Supply and Demand MT4 Indicator is a free RaptozGroup indicator for MetaTrader 4. Zones from confirmed price pivots. First retest alerts; zones freeze when a closing price invalidates them. No institutional-order inference.
Supply and Demand MT4 Indicator Overview
Version 3.00 implementation: Zones from confirmed price pivots. First retest alerts; zones freeze when a closing price invalidates them. No institutional-order inference. Test on a demo chart; this release does not claim identical results to third-party indicators.
What Is Supply and Demand in Forex and Financial Markets?
In financial markets, Supply and Demand represents the universal economic mechanism governing all price fluctuations. Unlike conventional retail technical indicators like moving averages or single horizontal support and resistance lines, Supply and Demand analysis focuses on the structural origin points where acute imbalances between institutional buying and selling volume occurred.
When large market participants (such as central banks, commercial institutions, and sovereign wealth funds) accumulate or distribute massive positions, their volume cannot be filled at a single price point without aggressively displacing the market. The consolidation bases formed immediately before these explosive momentum expansions leave behind Unmitigated Supply and Demand Zones. When price returns to these zones in the future, residual unfilled institutional limit orders often trigger high-probability price reversals or trend continuation moves.
Core Supply and Demand Formations & Structure Patterns
Supply and demand zones manifest in four fundamental price action structures, classified into continuation patterns and reversal patterns:
1. Rally-Base-Rally (RBR) – Bullish Continuation
Price rallies strongly, pauses in a tight consolidation base as orders are accumulated, and then explodes upward in a second momentum leg. The base represents a powerful demand continuation zone.
2. Drop-Base-Drop (DBD) – Bearish Continuation
Price drops aggressively, pauses in a brief distribution base, and resumes plunging downward. The consolidation base forms an institutional supply continuation zone.
3. Drop-Base-Rally (DBR) – Bullish Reversal
A falling market reaches an institutional accumulation zone, builds a multi-candle base at the bottom, and reverses into a violent upward rally, forming a fresh demand reversal zone.
4. Rally-Base-Drop (RBD) – Bearish Reversal
An advancing market reaches an institutional distribution zone, builds a consolidation base at the peak, and collapses into a severe sell-off, creating a fresh supply reversal zone.
Zone Freshness, Mitigation & Strength Scoring
Not all supply and demand zones are equal. The Supply and Demand MT4 Indicator evaluates and color-codes zones according to institutional strength metrics:
| Zone Status | Retest Count | Probability | Institutional Interpretation |
|---|---|---|---|
| Fresh (Unmitigated) | 0 Retests | Highest (80%+) | Unfilled institutional limit orders remain resting at the base level. |
| Tested (Mitigated Once) | 1 Retest | Moderate (55-65%) | A portion of resting liquidity was absorbed during the initial pullback. |
| Weak / Exhausted | 2+ Retests | Low (<40%) | Orders have been largely exhausted; zone is vulnerable to breakout invalidation. |
How the Supply and Demand MT4 Indicator Algorithm Works
The MQL4 indicator processes historical and live candlestick data on MetaTrader 4 through a multi-pass mathematical loop:
- Fractal Base Scanning: Scans historical bars to detect consolidation bases containing low true-range candles.
- Displacement Validation: Measures the velocity and pip range of the subsequent departure candles (requiring 2.0x+ Average True Range expansion).
- Rectangle Zone Plotting: Calculates the upper (Proximal line) and lower (Distal line) boundaries of the base and projects semi-transparent graphical rectangles forward.
- Dynamic Mitigation Tracking: Automatically monitors incoming tick prices and flags zones as tested or invalidates them when price closes through the distal boundary.
- Multi-Channel Alert Dispatch: Fires real-time terminal audio, popup alerts, and mobile push notifications when price penetrates an active zone.
How to Install the Supply & Demand Indicator on MT4
Follow these step-by-step instructions to install the MQL4 source code indicator on MetaTrader 4 Desktop:
- Download the raw source file:
SupplyDemand_Zones_MT4.mq4. - Open MetaTrader 4 and click File → Open Data Folder in the top menu.
- Navigate into the MQL4 → Indicators subfolder.
- Paste the downloaded
.mq4file directly into the Indicators folder. - Restart MT4 or right-click inside the Navigator panel and click Refresh.
- Drag SupplyDemand_Zones_MT4 onto any active chart window.
- In the indicator settings dialog, adjust zone strength, lookback bars, box colors, and alert preferences.
- Click OK to start real-time supply and demand mapping.
Supported MT4 Timeframes & Trading Styles
| Timeframe | Trading Style | Optimal Application |
|---|---|---|
| M1 / M5 | Scalping | Precision execution on lower-timeframe zone rejections. |
| M15 / M30 | Intraday Trading | Identifying intraday liquidity bases during London and NY sessions. |
| H1 / H4 | Day / Swing Trading | Mapping major structural supply/demand boundaries and trend bias. |
| D1 / W1 | Position Trading | Macro institutional order flow and multi-month reversal zones. |
Supply & Demand vs Support/Resistance vs Order Blocks
| Feature | Supply & Demand | Support & Resistance | ICT Order Blocks |
|---|---|---|---|
| Zone Type | Multi-candle base range | Single horizontal price line | Specific single origin candle |
| Core Trigger | Aggressive displacement imbalance | Repeated historical bounces | Break of Structure (BOS) creation |
| Freshness Decay | Weakens with every subsequent retest | Traditionally assumed stronger with more tests | Invalidated after initial mitigation |
Key Features & Capabilities
Input Parameters & Settings Guide
Configure the indicator inputs inside MetaTrader MT4 via the Inputs tab upon attaching to your chart:
| Parameter | Default Value | Description | Recommended |
|---|---|---|---|
| Lookback | 500 | Closed bars to scan; maximum 10000 | Demo-test first |
| SwingDepth | 3 | Pivot confirmation depth | Demo-test first |
| ShowLabels | true | Zone or structure labels | Demo-test first |
| BullColor | clrSeaGreen | Bullish objects | Demo-test first |
| BearColor | clrIndianRed | Bearish objects | Demo-test first |
| PopupAlerts | false | See implementation notes. | Demo-test first |
| PushAlerts | false | See implementation notes. | Demo-test first |
| EmailAlerts | false | See implementation notes. | Demo-test first |
| SoundAlerts | false | See implementation notes. | Demo-test first |
Trading Strategy & Entry Rules
Step 1: Identify Higher Timeframe (HTF) Trend & Key Zones
Open the H4 or Daily chart to identify major supply and demand zones that dictate macro market flow and institutional liquidity direction.
Step 2: Filter for Fresh (Untested) Zones
Prioritize zones that have zero retests since creation, as fresh zones possess the highest statistical likelihood of institutional orders remaining unfilled.
Step 3: Wait for Price Retracement into Zone
Let price pull back into the designated box. Never enter prematurely in the middle of a range without clean zone confluence.
Step 4: Lower Timeframe Confirmation
Switch to M15 or M5 to verify rejection candle wicks, engulfing patterns, or a structural Change of Character (CHoCH) shift before placing orders.
Step 5: Execute with Asymmetrical Risk/Reward
Place stop loss 5-10 pips beyond the distal (outer) edge of the zone and target the opposing supply/demand level for a minimum 1:3 risk-to-reward ratio.
MQL4 Source Code
Loading complete source file…
How to Install & Compile in MetaTrader MT4
Follow this complete step-by-step technical guide to install, compile, and configure the custom MQL4 indicator on your desktop trading terminal:
Download Source File
Download the raw .mq4 source file to your computer using the direct download button below.
Open MT4 Data Folder
Open your MetaTrader terminal, navigate to the top menu bar, click File → Open Data Folder, and open the MQL4 → Indicators subfolder.
Copy & Compile in MetaEditor
Paste the downloaded file into the Indicators directory. Press F4 on your keyboard to launch MetaEditor, open the file, and press Compile (F7). Ensure the compiler reports 0 errors and 0 warnings.
Attach to Chart & Configure
Return to your terminal, refresh the Navigator (Ctrl+N) panel, drag the indicator onto your active chart, and customize input parameters. These downloads do not require DLL imports.
Integrating with Expert Advisors (EA) via iCustom()
Buffer meanings differ between indicators. Check SetIndexBuffer and the plot labels in the complete source before using iCustom. A moving-average value is not a buy signal. Object-based zones and dashboards do not expose their drawings as signal buffers.
How to Set Up Mobile Push Notifications on iOS & Android
To receive the indicator’s supported alerts on your smartphone:
- Install the official MetaTrader MT4 app on your iPhone or Android smartphone.
- Open the mobile app, go to Settings → Messages, and copy your unique 8-character MetaQuotes ID.
- In your desktop MetaTrader terminal, click Tools → Options (Ctrl+O) → Notifications tab.
- Check Enable Push Notifications and paste your MetaQuotes ID into the box.
- Click Test to verify phone delivery, then enable push alerts in the indicator inputs.
Institutional Risk Management & Capital Preservation Protocol
Professional proprietary trading desks operate under strict risk control parameters to ensure longevity:
- Maximum 1% - 2% Risk Rule: Never risk more than 1% to 2% of total account equity on any individual trade setup.
- Minimum 1:2.5 Risk-to-Reward Ratio (RRR): Only execute setups where the potential profit target is at least 2.5 times greater than the stop-loss invalidation distance.
- Multi-Timeframe Confluence Required: Never take an intraday trade against the primary Daily or 4-Hour trend direction.
- High-Impact Economic News Awareness: Avoid entering new positions 15 minutes before and after major macroeconomic data releases (such as US Non-Farm Payrolls, CPI Inflation, and central bank FOMC/ECB interest rate announcements).
Strategy Backtesting & Historical Modeling Protocol
Before deploying any indicator or automated strategy in a live trading environment, professional quants conduct rigorous multi-year backtesting across varying market conditions:
- 99.9% Tick Data Modeling: Use high-precision tick history from reputable data providers (such as Dukascopy or TrueFX) to eliminate spread anomalies and slippage distortion.
- Spread & Commission Inclusion: Always test with realistic variable spreads and broker commission structures to simulate true real-world execution friction.
- Out-of-Sample Walk-Forward Optimization: Avoid curve-fitting by validating parameters on 70% in-sample data and testing robustness on 30% out-of-sample data.
- Monte Carlo Drawdown Analysis: Run randomized trade sequence simulations to calculate the maximum potential drawdown under adverse market volatility regimes.
Virtual Private Server (VPS) & Execution Latency Optimization
For active day traders, scalpers, and automated Expert Advisors, execution speed is paramount:
- Low-Latency Proximity Hosting: Deploy your MetaTrader MT4 terminal on a dedicated Windows VPS located in the same financial data center (e.g. Equinix LD4 in London or NY4 in New York) as your broker server to achieve sub-millisecond execution times.
- Terminal Memory Optimization: Go to Tools → Options → Charts and decrease Max bars in chart to 5,000 to conserve CPU and RAM resources.
- Audio & News Feed Disabling: Turn off unneeded terminal audio event chimes and background news feeds to ensure 100% of CPU cycles are dedicated to indicator calculations.
Common MetaTrader Error Codes & Resolution Matrix
| Error Code | Description | Exact Resolution Action |
|---|---|---|
| ERR_INVALID_STOPS (130) | Stop Loss or Take Profit is too close to current price. | Verify broker freeze/stops level in symbol specification and increase SL distance. |
| ERR_OFF_QUOTES (136) | Broker server has no available liquidity quotes. | Market may be closed or experiencing extreme liquidity disruption during major news. |
| ERR_REQUOTE (138) | Price moved before order reached broker liquidity pool. | Increase slippage tolerance deviation parameter in your order execution settings. |
| ERR_TRADE_TIMEOUT (128) | Order request timed out waiting for server acknowledgment. | Check internet connection latency or migrate terminal to a dedicated trading VPS. |
Institutional Quantitative Trading Lexicon
Broker Execution Models & Raw Spread Compatibility
To achieve optimal performance when using custom technical indicators:
- ECN / Raw Spread Accounts: Use True ECN accounts with 0.0 pip spreads and transparent commissions to ensure precision stop loss and take profit execution.
- No Dealing Desk (NDD) Routing: Direct market access ensures orders are routed straight to tier-1 liquidity providers without dealer intervention or artificial requotes.
- Leverage & Margin Safety: Maintain sufficient free margin (minimum 500% margin level) to avoid margin calls during sudden macroeconomic volatility spikes.
SupplyDemand_Zones_MT4.mq4
Version: v3.00File Size: 7.7 KBTotal Downloads: 15,000+Access: Free source downloadPlatform: MetaTrader MT4
Already using MetaTrader? Download the compiled .ex4 file and place it in MQL4/Indicators.
Frequently Asked Questions

Quantitative algorithmic trading research desk specializing in MetaTrader MQL4/MQL5 automated systems, institutional order book mechanics, and risk management tools.
