Range Compression Zones Breakout finds periods of narrowing range and draws each one as a zone on the chart. It follows the zone until a closed candle crosses one of its edges, then checks the cross against a higher-timeframe high/low filter and a rising-volume filter. A cross that passes both becomes a BUY or SELL signal with a reference entry, a stop at the opposite edge of the zone, and a target at your chosen reward-to-risk multiple. A cross that fails is marked on the chart and the zone is closed.
A status overlay shows the live compression ratio, the active zone, the state of both filters, the signal counts and the latest signal. The indicator supplies signals and analysis only. It does not open or manage any orders.
The idea is inspired by the range compression concept in Domenico D'Errico's Accumulation/Distribution study (Technical Analysis of Stocks & Commodities, August 2018). This is an independent implementation, not a literal port of the published study.


What market data or conditions the indicator analyses
The indicator reads OHLC candles, bar times, tick or real volume, and the high and low of a selected higher timeframe (H1, D1 or W1). In ATR mode it also calculates a Wilder-smoothed ATR on the chart timeframe. Its pipeline is:
Length is a number of bars on the chart timeframe, not days or weeks. The reference lookback is a number of bars on the reference timeframe. A reference bar counts only once it was complete at the time the signal candle closed.
| Data | How it is used |
|---|---|
| High, low, close | Range measurement, zone boundaries and the cross test. |
| Next bar's open | Reference entry price of a confirmed signal. |
| Tick or real volume | Two summed volume windows are compared by the volume filter. |
| H1, D1 or W1 high and low | The latest completed reference bar is compared with the bar Lookback bars earlier. |
| Bar times | Placing boxes, markers and lines, and deciding which reference bars were complete at the signal time. |
How to interpret signals and visual elements
Confirmed buy and sell signals
A buy signal needs a closed candle that crosses above the zone high, a latest completed reference low that is higher than the reference low Lookback bars earlier, and recent volume that is rising. A sell signal needs a close below the zone low, a latest completed reference high that is lower than the reference high Lookback bars earlier, and rising volume. A buy arrow sits below the signal candle and a sell arrow above it.
The arrow is placed on the signal candle, not at the reference entry price. The entry is the open of the next bar. A cross always closes the zone, whether it passes the filters or not. After a confirmed signal the zone is cleared and no new zone is armed on that bar.
The reference filter can be switched off. In that case a cross is accepted when the volume check and the trade plan are valid.
| Element | Interpretation |
|---|---|
| Active zone | Dashed box in the active zone colour (blue by default), stretched to the current bar. Its edges are the highest high and lowest low of the arming window. |
| Finished zone box | Solid box from the start of the zone window to the signal candle. Green for a confirmed buy, red for a confirmed sell, grey for a cross rejected by a filter. |
| Zone tag | For example RC HL 54.2% (<75%): range mode, compression ratio at the arming bar, threshold, then the outcome (BUY, SELL or FILTERED). The ratio is a measurement, not a quality score. |
| Buy / sell arrow | A confirmed signal on a closed candle. Green up arrow below the candle for a buy, red down arrow above it for a sell. |
| Grey cross mark | A breakout that crossed the zone edge but was rejected by a filter or by an invalid trade plan. It is shown so you can see what was filtered out. |
| Entry, SL, TP lines | Short horizontal lines starting at the bar after the signal: dotted entry, solid stop, solid target, each with a price tag. |
| Reference lines | The latest completed reference high and low (solid) and the high and low Lookback bars earlier (dotted). Lows are drawn in the buy colour and highs in the sell colour. They show the current state, not the state at the time of an older signal. |
| Status overlay | Text rows in the chosen chart corner, described below. |
Entry, stop and target
The stop is based on the zone boundary, not on the candle wick. There is a single target. The levels are a reference plan, not a broker position, and no trailing or break-even logic is applied.
Status overlay
| Row | Meaning |
|---|---|
| Mode | Range mode, Length and threshold in use. |
| Ratio | Compression ratio of the last closed bar, flagged COMPRESSED or normal. |
| Zone | ARMED with the zone low and high, or none. |
| Ref | Whether the reference filter would currently accept a buy and a sell, as of now. It describes the present state of the reference timeframe, not a past signal. |
| Volume | Whether the volume condition is met on the last closed bar. |
| Signals | Count of confirmed buys, confirmed sells and filtered crosses in the calculated history. |
| Last | Direction and time of the latest confirmed signal. |
Alerts and buffers

Key settings and parameters
The table covers every input. Colour defaults can be changed in the input dialog.
| Setting (input name) | Default | Description |
|---|---|---|
| Range Compression | ||
| Range Length / Offset (InpLength) | 4 | Range window and comparison offset, in bars of the chart timeframe. Range 1-10000. |
| Compression Threshold (%) (InpFactor) | 75 | A bar is compressed when the recent range is strictly below this percentage of the past range. Lower values find only stronger compressions. Range 0-1000. |
| Calculation Mode (InpMode) | High-Low | High-Low range or ATR with Wilder smoothing, both using Length. |
| Volume Confirmation | ||
| Minimum Volume Ratio (InpVolRatio) | 1.0 | Recent volume must be greater than the earlier volume multiplied by this value. |
| Volume Average Length (InpVolAvgLength) | 4 | Number of bars summed in each of the two windows being compared. |
| Volume Average Delay (InpVolDelay) | 4 | The recent window ends this many bars before the signal candle. The earlier window is one averaging length further back. |
| Volume Source (InpVolumeType) | Tick volume | Tick volume or real volume. |
| Higher-Timeframe Filter | ||
| Enable High/Low Filter (InpUseReferenceFilter) | true | Turns the higher-timeframe filter on or off. |
| Reference Timeframe (InpReferenceTf) | D1 | H1, D1 or W1. |
| Lookback Bars on Reference Timeframe (InpReferenceLookback) | 12 | The latest completed reference bar is compared with the bar this many bars earlier. W1 with 12 compares with 12 weeks earlier; D1 with 12 compares with 12 days earlier. |
| Risk and Targets | ||
| Reward-to-Risk Ratio (1:R) (InpRewardRisk) | 2.0 | The target is placed at this multiple of the distance between the entry and the stop. There is one target; no separate TP levels. |
| Display | ||
| Max History Bars to Render (InpDisplayBars) | 1500 | Zones, arrows and trade levels are drawn only for this many recent bars. Older history is still calculated. |
| Fill Zone Boxes (InpFillZones) | true | Fills the zone boxes. Turn it off for outline-only boxes. |
| Show Zone and Price Tags (InpShowLabels) | true | Shows the zone tags and the price tags on trade levels and reference lines. |
| Show Entry / SL / TP Lines (InpShowTradeLevels) | true | Draws the entry, stop and target lines for confirmed signals. Does not change the signal buffers. |
| Trade Line Length (Bars) (InpTradeBars) | 12 | Length of the trade-level lines in bars. |
| Show Filtered-Out Crosses (InpShowRejected) | true | Draws a grey cross mark where a breakout was rejected. |
| Show Reference High/Low Lines (InpShowReference) | true | Draws the latest and the lookback reference highs and lows. |
| Show Status Overlay (InpShowOverlay) | true | Shows or hides the status overlay. Calculations continue while hidden. |
| Overlay Corner (InpOverlayCorner) | Top left | Chart corner for the status overlay. |
| Colours | ||
| Active Zone Color (InpZoneColor) | DodgerBlue | Colour of the active zone and of the entry line. |
| Buy Signal and Target Color (InpBullColor) | SpringGreen | Colour of buy signals, buy zones, target lines and reference lows. |
| Sell Signal and Stop Color (InpBearColor) | Crimson | Colour of sell signals, sell zones, stop lines and reference highs. |
| Filtered Cross Color (InpRejectedColor) | SlateGray | Colour of crosses rejected by a filter. |
| Alerts | ||
| Pop-Up Alert on Signal (InpAlertPopup) | true | Shows a terminal popup when a confirmed signal appears. |
| Mobile Push Notification (InpAlertPush) | false | Sends the signal to the MetaQuotes ID configured in the terminal. |
| Play Sound on Signal (InpAlertSound) | false | Plays a sound when a confirmed signal appears. |
| Alert Sound File (InpAlertSoundFile) | alert2.wav | WAV file in the terminal's Sounds folder. |

Typical use cases and trading scenarios
| Use case | Example scenario | Interpretation |
|---|---|---|
| Breakout after compression (buy) | A zone forms, a candle closes above its high, the reference low is higher than 12 reference bars earlier, and volume is rising. | A buy signal is confirmed on that candle. Review the stop at the bottom of the zone and the resulting target before relying on it. |
| Breakdown (sell) | A candle closes below the zone low, the reference high is lower than 12 reference bars earlier, and volume is rising. | A sell signal is confirmed. The stop is at the top of the zone. |
| Filtered breakout | A candle closes above the zone high but the reference low is not higher, or volume is not rising. | No signal. A grey cross is drawn, the zone is closed and the box turns grey. |
| Choosing the reference timeframe | Trading M5 with D1 and a lookback of 12 versus W1 and a lookback of 12. | The first compares today's context with about 12 days earlier, the second with about 12 weeks earlier. Compare the two on the same chart and data. |
| High-Low versus ATR mode | Switching the mode while keeping Length and the threshold unchanged. | The two modes measure range differently, so they find different compressions. Judge them on the same symbol and period. |
| Threshold research | Lowering the threshold from 75% to 60%. | Fewer, stricter compressions. It changes what qualifies, not how good a signal is. |
| Expert Advisor integration | An EA reads BuySignal and SellSignal through iCustom. | The EA can use the confirmed signals and apply its own execution, sizing and position rules. |
Example workflow
Who is this indicator best suited for?
| User profile | How it helps |
|---|---|
| Breakout and price-action traders | Shows periods of narrowing range as boxes and applies the same rules to every breakout of them. |
| Multi-timeframe analysts | Adds a higher-timeframe high/low comparison and shows the reference levels it uses. |
| Strategy developers | Supplies the ratio, compression flag, range and signal buffers for custom indicators and Expert Advisors. |
| Researchers | Makes it easy to compare thresholds, range modes, reference timeframes and volume settings on the same data. |
| Learners | Separates the steps of compression, zone, cross, filters and trade plan, and shows which step rejected a breakout. |
The indicator is best suited to users who understand range, ATR, higher-timeframe context and risk multiples. It supplies signals and reference levels. Execution, position sizing and account risk are left to you.
Important limitations and usage notes
Tick-Based Spread Distribution Profiler reads historical Bid/Ask ticks via CopyTicksRange
Tick-Based Spread Distribution Profiler reads historical Bid/Ask ticks via CopyTicksRange() and plots 24h spread percentiles (P50, P90, P99) in a separate subwindow. Key Features: - True Tick Percentiles: Plots Median (P50 histogram), P90 (orange line), and P99 (red dotted line) in points for every server hour (00-23h). - Unbiased Reservoir Sampling: Samples multi-week history within InpMaxSamplesPerHour without biasing early days. - Closed-Bar Friction Ratio: Uses closed-bar iATR (shift=1) to show Spread_P50 / ATR (%) and spot low-friction hours. - Clean Subwindow HUD: Displays global/current-hour stats and best/worst hours, with zero log spam and full OnDeinit() cleanup. - Optional CSV Export: Exports 24h Min/P50/P90/P99/Max stats to MQL5\Files\SpreadProfile_<Symbol>.csv. Inputs: InpLookbackDays (14), InpMaxSamplesPerHour (50000), InpAtrTimeframe (M15), InpAtrPeriod (14), InpRefreshMinutes (60), InpShowSummaryHUD, InpExportCSV.
Execution and Slippage Forensics audits MetaTrader 5 account history
Execution & Slippage Forensics audits MetaTrader 5 account history (Orders vs Deals) to quantify real execution quality in points and currency. Key Features: - Order-to-Deal Matching: Pairs each fill to its parent order (ORDER_PRICE_OPEN vs DEAL_PRICE), skipping synthetic 0.0 prices. - Clear Sign Convention: (+) favorable price improvement, (-) adverse slippage. - 4-Category Breakdown: ALL_MEASURED, ENTRIES, SL_EXITS, and OTHER_EXITS (Mean, Median, Adverse %, Positive %, Net Slippage). - 24-Hour Profile: Identifies Broker Server hours where rollover or illiquidity worsens fills. - Hidden Execution Drag: Totals adverse slippage + commissions + fees + swaps vs Gross Winning Profit (%). - CSV Export: Saves ExecutionForensics_Deals.csv and ExecutionForensics_Hourly.csv to MQL5\Files\. Inputs: InpLookbackDays (90, 0=all), InpSymbolFilter, InpMagicFilter (-1=all), InpExportCSV, InpShowChartComment, InpTopWorstDeals.
Accelerator Oscillator (AC)
The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.
MACD Signals
Indicator edition for new platform.