MetaTrader MT4 Indicator 100% Free MQL Source Code

Liquidity Zones & Sweeps MT4 Indicator

RaptozGroupBy RaptozGroup
4.9 (120 reviews)
15,000+ Downloads
Liquidity Zones MT4 Indicator Example

Liquidity Zones and Sweeps MT4 indicator identifying BSL/SSL pools.

The Liquidity Zones & Sweeps MT4 Indicator is a free MQL4 technical tool that automatically maps BSL and SSL pools, highlights equal highs/lows, and sends real-time alerts when institutional stop hunts occur.

Liquidity Zones & Sweeps MT4 Indicator Overview

What Is Liquidity and Stop Sweeping in Smart Money Trading?

In Smart Money Concepts (SMC) and institutional order flow theory, Liquidity is the lifeblood of financial markets. Major institutions, algorithmic funds, and commercial banks cannot enter or exit large multi-million-dollar positions without causing excessive slippage unless they can match their orders against substantial clusters of opposing market orders.

These resting order pools naturally accumulate above double tops (Buy-side Liquidity / BSL consisting of buy stop orders and short seller stop losses) and below double bottoms (Sell-side Liquidity / SSL consisting of sell stop orders and long buyer stop losses). When price briefly pierces these levels and rapidly snaps back, an institutional Liquidity Sweep (Stop Hunt) has occurred, engineering counterpart volume before launching an aggressive reversal.

Buy-Side Liquidity (BSL) vs Sell-Side Liquidity (SSL)

Buy-Side Liquidity (BSL)

Resting orders located above prominent swing highs, equal highs (EQH), and previous session peaks. Traps breakout retail buyers and stops out retail short positions before institutional sellers push price lower.

Sell-Side Liquidity (SSL)

Resting orders located below prominent swing lows, equal lows (EQL), and previous session troughs. Traps breakout retail sellers and stops out retail long positions before institutional buyers accumulate long size.

Internal Range Liquidity (IRL) vs External Range Liquidity (ERL)

Market delivery cycles continually alternate between two states: External Range Liquidity (swing high/low sweeps) and Internal Range Liquidity (rebalancing Fair Value Gaps and Order Blocks inside the range). When price sweeps external liquidity, it seeks internal fair value; once balanced internally, it expands back outward toward the next external liquidity pool.

Anatomy of a High-Probability Liquidity Sweep (Judas Swing)

A genuine institutional liquidity sweep displays three non-negotiable structural phases:

  1. Liquidity Engineering Phase: Price builds obvious, equal swing highs or equal swing lows, enticing retail participants to place stop loss orders directly above or below the boundary.
  2. The Purge / Sweep Spike: A rapid momentum wick pierces through the liquidity pool, triggering resting stop orders and providing deep liquidity to institutional market makers.
  3. Displacement & CHoCH Reversal: Price immediately closes back inside the original range, followed by a violent Change of Character (CHoCH) displacement candle in the true intended direction.

How the Liquidity Zones MT4 Indicator Operates

The custom MQL4 indicator uses mathematical fractal algorithms to automate liquidity tracking:

  1. Identifies multi-bar swing highs and swing lows across customizable lookback intervals.
  2. Detects Equal Highs (EQH) and Equal Lows (EQL) with adjustable pip tolerance filters.
  3. Draws dotted and solid horizontal liquidity pool lines labeled with BSL / SSL tags.
  4. Monitors real-time tick wicks to detect when a level is breached and immediately rejected.
  5. Fires instant audio, popup, and push notifications when a sweep event confirms on candle close.

Pro Trader Execution Rules & Pitfalls to Avoid

  • Never Trade the Breakout Directly: Avoid market-entering on the initial breakout of equal highs or equal lows; wait for the wick rejection to confirm whether it is a sweep or a genuine expansion.
  • Require a Lower Timeframe CHoCH: After a 15-minute or 1-hour liquidity sweep, drop down to the 1-minute or 5-minute chart to confirm an internal Change of Character before entering.
  • Target Opposing Liquidity Pools: When you buy an SSL sweep, your logical target is the opposing BSL pool resting at the previous session high.

Supported MT4 Timeframes for Liquidity Analysis

TimeframeTrading StyleFocus Area
M1 / M5ScalpingAsian session high/low sweeps & micro-structure entries.
M15 / H1Intraday TradingPrevious Day High (PDH) and Previous Day Low (PDL) sweeps.
H4 / D1Swing TradingPrevious Week High (PWH) / Low (PWL) institutional re-accumulations.

Key Features & Capabilities

Automatic detection of Buy-side (BSL) and Sell-side (SSL) liquidity
Identifies Equal Highs (EQH) and Equal Lows (EQL) with pip tolerance
Real-time sweep alerts upon confirmed wick rejections
Non-repainting historical pool markers and labels
Fully compatible with MT4 Build 1420+ across all assets

Input Parameters & Settings Guide

Configure the indicator inputs inside MetaTrader MT4 via the Inputs tab upon attaching to your chart:

ParameterDefault ValueDescriptionRecommended
InpLookbackBars200Bars back to detect swing liquidity pools200-500 bars
InpEqualPipsTolerance3.0Maximum pips difference for EQH/EQL2.0-4.0 pips
InpShowBSLLabelstrueDisplay Buy-side Liquidity tagsTrue
InpShowSSLLabelstrueDisplay Sell-side Liquidity tagsTrue
InpAlertOnSweeptrueAudio & popup alert on confirmed sweepTrue

Trading Strategy & Entry Rules

1

Step 1: Mark Major Liquidity Targets

Locate un-swept Previous Day Highs (PDH), Previous Day Lows (PDL), or Equal Highs/Lows on the 1-Hour chart.

2

Step 2: Wait for the Stop Hunt Wick

Observe price piercing the liquidity level and rapidly rejecting back into the established range.

3

Step 3: Confirm with Lower Timeframe Structure

On M5 or M15, wait for a displacement candle that creates a Change of Character (CHoCH) and a Fair Value Gap (FVG).

4

Step 4: Execute on Pullback to FVG

Enter on the retracement into the newly formed FVG with stop loss positioned beyond the sweep wick extreme.

5

Step 5: Target Opposing Liquidity Pool

Set profit targets at the opposing BSL/SSL pool for a 1:3 to 1:5 risk-to-reward ratio.

MQL4 Source Code

//+------------------------------------------------------------------+
//|                                  Liquidity_Zones_Sweep_MT4.mq4   |
//|                    Copyright 2026, TraderSentiments Quant Team   |
//|                                    https://tradersentiments.com  |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, TraderSentiments"
#property link      "https://tradersentiments.com/indicators/mt4/smart-money/liquidity-zones-indicator"
#property version   "2.00"
#property strict
#property indicator_chart_window

input int      InpLookbackBars     = 200;         // Lookback Calculation Bars
input double   InpEqualPipsTolerance= 3.0;        // EQH/EQL Pip Tolerance
input bool     InpShowBSLLabels    = true;        // Show BSL Labels
input bool     InpShowSSLLabels    = true;        // Show SSL Labels
input bool     InpAlertOnSweep     = true;        // Popup Alert on Sweep Confirmation

int OnInit() {
   IndicatorShortName("Liquidity Zones & Sweeps MT4");
   return(INIT_SUCCEEDED);
}

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:

Step 1

Download Source File

Download the raw .mq4 source file to your computer using the direct download button below.

Step 2

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.

Step 3

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.

Step 4

Attach to Chart & Configure

Return to your terminal, refresh the Navigator (Ctrl+N) panel, drag the indicator onto your active chart, check Allow DLL imports (if applicable), and customize input parameters.

Integrating with Expert Advisors (EA) via iCustom()

Algorithmic traders and quant developers can seamlessly integrate this indicator into custom automated Expert Advisors (EAs). Because the indicator calculates values into standardized plot buffers on closed bars, you can query buffer values using native MQL4 functions without recompilation:

// MT4 MQL4 iCustom Calling Syntax Example
double signalBuy  = iCustom(Symbol(), Period(), "Liquidity_Zones_Sweep_MT4", 0, 1);
double signalSell = iCustom(Symbol(), Period(), "Liquidity_Zones_Sweep_MT4", 1, 1);

if (signalBuy != 0.0 && signalBuy != EMPTY_VALUE) {
    // Bullish signal confirmed on closed bar [1] -> Execute Buy Order
}
if (signalSell != 0.0 && signalSell != EMPTY_VALUE) {
    // Bearish signal confirmed on closed bar [1] -> Execute Sell Order
}

How to Set Up Mobile Push Notifications on iOS & Android

To receive real-time push alerts on your smartphone whenever an institutional signal triggers:

  1. Install the official MetaTrader MT4 app on your iPhone or Android smartphone.
  2. Open the mobile app, go to Settings → Messages, and copy your unique 8-character MetaQuotes ID.
  3. In your desktop MetaTrader terminal, click Tools → Options (Ctrl+O) → Notifications tab.
  4. Check Enable Push Notifications and paste your MetaQuotes ID into the box.
  5. 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 CodeDescriptionExact 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

Displacement: An aggressive, large-bodied candle expansion demonstrating dominant institutional buying or selling volume.
Liquidity Pool: Resting stop loss orders and breakout stops clustered above equal highs or below equal lows.
Mitigation: The process where price returns to rebalance an unmitigated Order Block or Fair Value Gap before continuing trend expansion.
Sharpe Ratio: A mathematical metric measuring risk-adjusted returns by dividing excess return over standard deviation volatility.

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.

Liquidity_Zones_Sweep_MT4.mq4

Version: v2.00File Size: 16.8 KBTotal Downloads: 15,000+License: Free Open SourcePlatform: MetaTrader MT4

Download .mq4
VirusTotal Verified Clean • Zero DLL Dependencies
15,000+ DownloadsCompatible with MT4 Build 1420+

Frequently Asked Questions

A breakout closes strongly outside the range and continues with momentum. A liquidity sweep only pierces the level with a wick (or closes briefly) before immediately snapping back in the opposite direction.
RaptozGroup
Developed & Audited by RaptozGroup

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

Liquidity_Zones_Sweep_MT4.mq4
15,000+ DownloadsFree Open Source
Download .mq4