Liquidity Sweep Pools MTF
- Indicateurs
- Version: 1.0
- Activations: 20
A liquidity pool is a confirmed swing high or swing low that has not yet been taken. A liquidity sweep is the bar on which price trades beyond that level and then closes back inside the range - the same event traders also call a stop hunt, a stop run, a liquidity grab or a false breakout. Liquidity Sweep Pools MTF marks both the pools and the liquidity sweeps taken on them, on the current chart and on a higher timeframe you choose, and adds a live panel of active pools, a volume filter on pool formation, and CSV export of detected sweeps.
Multi timeframe confirmation here means each liquidity sweep can be read against the pools of a higher timeframe without leaving the chart in front of you, with both sets of levels drawn side by side in their own colours.
What This Indicator Does Not Do
It does not open, close or manage positions, and it issues no entry or exit signals. It does not draw order blocks, fair value gaps, break-of-structure or change-of-character markers, and it does not label market phases. The panel and the CSV file describe pool geometry only - price level, side, distance, age - and carry no outcome, no probability, and no signal-strength label of any kind.
Multi Timeframe Pool Confirmation
The indicator can plot pools formed by the same rule on a higher timeframe directly on the current chart, in a separate colour and line width, so both timeframes are visible without switching charts. A higher timeframe pool never appears on the lower timeframe before the higher timeframe bar that confirmed it has fully closed: the earliest lower timeframe bar allowed to carry it is the one whose open time is at or after that higher timeframe bar's close time. The closed-bar rule is extended across timeframes rather than relaxed for convenience.
While the higher timeframe's history is still loading, the panel reports it explicitly ("MTF: loading history") instead of showing zero pools as if none existed. Setting the higher timeframe to the current timeframe, or to a timeframe that is not strictly higher, turns the function off; one line is written to the terminal log explaining why, and the chart the trader already has open is left as it is.
Active Pool Panel
A table in the corner of the chart lists the currently active pools on the symbol and chart it is attached to: price level, side (high or low), distance from the last closed bar's price in units of Average True Range, age in bars since confirmation, and which timeframe the pool belongs to. The panel updates when a bar closes or the set of pools changes, not on every tick. Row count is capped by an input and by a hard internal limit, so a chart with a long pool history cannot grow the panel without bound. If the volume filter removes every pool from the count, the panel says so directly ("Volume filter: 0 pools passed") rather than showing an empty table.
Volume Filter
Two bars can form the same swing shape with very different volume behind them. A bar can be required to clear a volume threshold, relative to the median volume of a lookback window, before it is allowed to become a liquidity pool. Real volume is zero on most forex feeds; the filter can read tick volume, real volume, or decide automatically, and in automatic mode it switches to tick volume when real volume over the recent window is empty, logging that it did so rather than silently returning nothing. The filter is off by default; enabling it changes which pools are drawn.
CSV Export of Detected Sweeps
On request, the indicator writes one file per chart session into the terminal's local Files folder, listing every liquidity sweep visible in the current window: timestamp, symbol, timeframe, side, level price, the sweeping bar's high, low and close, how far price reached beyond the level and how large a share of the bar's range it gave back at the close, the pool's age in bars and its confirmation time. The file carries no result, price, or pips beyond the sweep bar itself, and no column implies what happened afterward; anything past the sweep is for the trader to compute on their own data. The write happens once per chart session and is atomic - a temporary file is renamed into place - so an interrupted write never leaves a half-written CSV behind.
Calculation and Repainting
All values, on the current timeframe and on the higher timeframe alike, are calculated on closed bars only. Once a bar closes, its buffer values are fixed and are never modified afterward, and a higher timeframe pool is never back-dated onto lower timeframe bars that existed before that pool could have been known.
Buffers for Programmatic Access
Six buffers are exposed and can be read from an Expert Advisor through iCustom:
- Buffer 0 - price of the swept level on the bar where a high-side sweep occurred
- Buffer 1 - price of the swept level on the bar where a low-side sweep occurred
- Buffer 2 - price of the nearest tracked level above, on the current timeframe
- Buffer 3 - price of the nearest tracked level below, on the current timeframe
- Buffer 4 - price of the nearest tracked level above, on the configured higher timeframe
- Buffer 5 - price of the nearest tracked level below, on the configured higher timeframe
Buffers 4 and 5 hold the empty value while the higher timeframe function is off or its history is still loading, the same way buffers 2 and 3 hold the empty value on bars carrying no data.
Notes
The first bars of the scan window form a warm-up region and may contain fewer marks, since levels older than the window do not yet exist within it. This applies to the higher timeframe scan as well as the current one.
Support
Questions and error reports are handled through the comments section of this product or through mql5.com private messages.
Input Parameters
Pool and sweep detection
- PoolPivotBars - bars on each side confirming a pool
- PoolMaxAgeBars - pool lifetime in bars
- PoolMergeAtr - merge pools closer than this (ATR)
- PoolMinBarRangeAtr - minimum pool bar range (ATR)
- ReachAtrPeriod - ATR period for distance scaling
- SweepMinReachAtr - minimum reach beyond a pool (ATR)
- SweepMaxReachAtr - maximum reach beyond a pool (ATR)
- SweepMinReachTicks - minimum reach in instrument ticks
- SweepMinRejectShare - minimum share of bar range given back
- HistoryBarsLimit - bars to scan, 0 for all
- MarkupVisible, MarkupPoolColor, MarkupSweptHighColor, MarkupSweptLowColor, MarkupLineWidth
- NotifyPopup, NotifyPush
Multi timeframe, panel, volume filter and export
- HigherTimeframe - higher timeframe for pool confirmation; current timeframe turns it off
- HigherPoolColor, HigherLineWidth - colour and width of higher timeframe pools
- PanelVisible - show the active pool panel
- PanelMaxRows - rows shown in the panel
- PanelCorner - panel corner: 0 upper left, 1 upper right
- PanelXOffset, PanelYOffset - panel offset from the chosen corner
- PanelTextColor, PanelFontSize - panel text appearance
- VolumeFilterEnabled - require a volume threshold on the pool bar
- VolumeSourceMode - volume source: automatic, tick volume, or real volume
- VolumeMedianBars - bars used for the volume median
- VolumeMinRatio - pool bar volume / median threshold
- ExportSweepsToCsv - write detected sweeps to a CSV file once per chart session
