Skip to content

Indicator Releases

ICT Gold Engine 5m: Mechanizing Liquidity Sweeps and Structural Shifts

Not financial advice. Backtested performance does not predict future results. See our risk disclosure.

TL;DR

  • Function: An overlay scanner that mechanizes the detection of liquidity sweeps, ATR-based displacement, and Fair Value Gap (FVG) retracements via a sequential state machine.
  • Target Market/Timeframe: Designed for 5-minute charts (symbol-agnostic, despite the 'Gold' title) while referencing a 60-minute higher-timeframe (HTF) filter.
  • Key Edge: Replaces subjective chart-reading with rigid, quantified parameters for displacement (ATR ratios) and structure (N-bar pivot confirmations).

Not financial advice. Backtested performance does not predict future results.

Context & Thesis

Discretionary traders often rely on concepts like "liquidity sweeps" and "market structure shifts" (MSS), but these are frequently plagued by hindsight bias. A trader might visually identify a sweep that worked and ignore one that failed, simply because their definition of "displacement" is subjective.

The ICT Gold Engine 5m was built to strip out this subjectivity. By translating visual setups into strict, parameterized logic, we can test whether momentum ignition—specifically a false breakout (sweep) followed by aggressive mean reversion (displacement) and a subsequent pullback (FVG)—actually holds a verifiable edge when aligned with a higher-timeframe trend. The mechanism relies on volatility-adjusted thresholds rather than static point values, allowing it to adapt to changing market conditions. However, the inherent limit of this approach is lag: confirming a structural pivot inherently requires waiting for subsequent price action to print, meaning the setup is only identified after the initial momentum has already occurred.

Methodology: Logic Walkthrough

The script operates via a sequential state machine. It does not look for static conditions concurrently; rather, it tracks the market through a series of dependencies:

  1. Swing Identification: The engine maps structure using a Confirmed swing length of 5. This means a pivot high or low is only locked in after 5 consecutive bars have closed on the right side of the extreme.
  2. Liquidity Sweep: A sweep is defined programmatically. A bullish sweep occurs if price trades below the most recent confirmed swing low but closes back above it. A bearish sweep requires trading above a swing high and closing below it. The engine allows a Sweep memory of 12 bars to link this event to the next phase.
  3. ATR-Based Displacement: To qualify as a valid structural shift, the move away from the sweep must exhibit quantifiable momentum. Using a 14-period ATR, the displacement candle's body must be $\ge 0.75 \times ATR$, its total range must be $\ge 1.20 \times ATR$, and it must close strictly beyond the preceding candle.
  4. Fair Value Gap (FVG): The script scans for a 3-candle imbalance linked to the displacement move, requiring a minimum gap size of $0.10 \times ATR$.
  5. HTF Alignment: By default, a 60-minute Structural HTF bias acts as a directional filter. An alternative 50 EMA filter on the HTF is also available.

The indicator features two primary signal paths. Balanced (the default) looks for a confirmed FVG within two bars of displacement and waits for a pullback. Selective A+ enforces the strict state sequence: Sweep $\rightarrow$ Displacement $\rightarrow$ Market Structure Shift $\rightarrow$ Linked FVG $\rightarrow$ Retracement.

Core Logic Implementation (Pine Script v6 Snippet)

To demonstrate how the subjective idea of "displacement" is quantified within the engine, here is a representative Pine Script v6 implementation of the indicator's ATR-based displacement logic:

// Representative logic for ATR-based Displacement
//@version=6
indicator("Displacement Logic Snippet")

// Inputs mapped to indicator defaults
int   atrLength     = input.int(14, title="ATR Length")
float bodyAtrRatio  = input.float(0.75, title="Body to ATR Ratio")
float rangeAtrRatio = input.float(1.20, title="Range to ATR Ratio")
bool  reqClose      = input.bool(true, title="Closes Beyond Prior Candle")

// Volatility baseline
float currentAtr = ta.atr(atrLength)

// Candle metrics
float candleBody  = math.abs(close - open)
float candleRange = high - low

// Bullish and Bearish Displacement conditions
bool isBullishDisplacement = (candleBody >= (currentAtr * bodyAtrRatio)) and 
                             (candleRange >= (currentAtr * rangeAtrRatio)) and 
                             (not reqClose or close > close[1]) and 
                             (close > open)

bool isBearishDisplacement = (candleBody >= (currentAtr * bodyAtrRatio)) and 
                             (candleRange >= (currentAtr * rangeAtrRatio)) and 
                             (not reqClose or close < close[1]) and 
                             (close < open)

Backtest Results

Quantitative backtest data, win rates, and walk-forward validation metrics are currently pending for this script. No historical performance evidence, sample sizes, or out-of-sample data were supplied for this initial release.

Because the indicator defaults to drawing visual Entry, Stop Loss (1.5 ATR), and Take Profit lines (1R, 2R, 3R), it is built to facilitate automated strategy conversion. However, users must conduct their own robust in-sample and out-of-sample testing via a dedicated Strategy script before making any assumptions about the viability of this logic.

Key Takeaways

  • Use the 'Selective A+' Profile for strict testing: If your goal is to validate the classic sweep-to-FVG narrative, the default "Balanced" mode may be too loose. The Selective A+ mode enforces the precise sequence of events required for a textbook setup.
  • Understand the lag constraint: The required 5-bar confirmation for swing points inherently delays the recognition of sweeps. The engine accommodates this via its 12-bar Sweep Memory, but quants should factor this latency into any automated execution models.
  • Visual planning is not execution: The dashed entry/SL/TP lines are purely visual markers for forward-testing and chart review. They do not manage orders natively.

Full Risk Disclosure

The information provided in this review is for educational and research purposes only. AlgoNexta is a platform for building and documenting trading algorithms; it does not provide financial, investment, or trading advice. Algorithmic trading involves substantial risk of loss and is not suitable for all investors. Any logic, indicators, or code snippets discussed here are theoretical and have not been validated by out-of-sample performance metrics. Backtested performance, even when available, does not predict future results. You are solely responsible for verifying the code, conducting your own historical testing, and managing your risk parameters before risking live capital.

Educational and research content. Not financial advice. Trading involves substantial risk of loss.

Explore more

Browse the indicator library

View indicators

We use cookies to understand how the site is used and improve it. We only load analytics after you accept. Privacy Policy

ICT Gold Engine 5m: AlgoNexta Indicator Review & Logic