Engineering5 min read

FVG detection algorithms: why a gap is only the beginning

Three price comparisons can find a gap. Reliable agent analysis also needs confirmation timing, fill state, age, price relation and an honest account of missing data.

By

FVG detection algorithmFair Value GapICTSMCmarket analysis

In brief

  • FVG geometry can be computed without a language model.
  • Closed-candle formation and live-candle mitigation answer different questions.
  • Partially filled zones remain active until full fill in the analytical contract.
  • Heuristic quality ranks are not validated trading probabilities.

Can AI identify a Fair Value Gap?

Yes, a trading system can identify a Fair Value Gap, but a language model is not needed for the geometric detection. A deterministic algorithm compares the first and third candles in a three-candle sequence. AI can then interpret the gap alongside market structure and liquidity. Detection, interpretation and permission to trade are different steps.

The Academy FVG lesson explains the concept and provides educational examples. This article focuses on data engineering: what an agent needs after a pattern detector returns a zone, and which conclusions the observations do not support.

Define the geometric rule first

For three candles A, B and C, a bullish gap exists when C's low is above A's high. The zone spans A's high to C's low. A bearish gap exists when C's high is below A's low; its zone spans C's high to A's low. The middle candle connects the sequence, but these comparisons alone do not establish institutional intent or a profitable future reaction.

Here is illustrative Python expressing the price relation. It is teaching code, not the complete production detector:

def gap_zone(a, b, c):
    if c["low"] > a["high"]:
        return {"side": "bullish", "low": a["high"], "high": c["low"]}
    if c["high"] < a["low"]:
        return {"side": "bearish", "low": c["high"], "high": a["low"]}
    return None

The LiquidMind detector implements these relations. Its analytical contract uses closed candles for new formation. If a feed includes an unfinished last candle, the detector must not treat it as the confirmed third candle. Feed ordering, candle closure and symbol/timeframe identity are prerequisites for interpreting the result.

Formation time and evidence time are different

The zone becomes confirmed when candle C closes. A detector may internally identify the central candle, but the agent-facing formation time should express when the three-candle pattern became available. LiquidMind's schema v2 reports confirmation time and age in closed candles.

This distinction matters for replay and evaluation. A chart rendered later can show an obvious gap that was not yet confirmed at the moment a hypothetical decision was made. Using it too early introduces look-ahead information. A publication claiming historical performance needs a methodology that rules out this error; a pattern definition alone cannot do so.

Mitigation changes the meaning of the original box

LiquidMind's FVG analytical contract uses wick-based mitigation, including the live candle. This differs intentionally from formation, which requires closed candles. A live wick can enter an existing zone before that candle closes, while an unfinished new three-candle pattern remains provisional.

Suppose a bullish zone spans 100 to 102. An illustrative retracement to 101 enters halfway through that zone from its upper edge. Under a wick-based fill interpretation, that represents 50% fill. This example illustrates geometry; it is not an observed trade or a claim about future price direction.

The current output distinguishes these states:

State Fill percentage
Fresh 0%
Lightly mitigated Greater than 0%, below 25%
Partially mitigated At least 25%, below 50%
Deeply mitigated At least 50%, below 100%
Filled 100%

An active gap has less than 100% fill. Active therefore does not mean untouched. A scanner that labels all surviving boxes “fresh” would erase information needed for an agent's assessment.

Distance should refer to an explicit edge

A single midpoint distance can be misleading near a wide zone. LiquidMind describes whether the reference price is above, below or inside the gap, and reports distance to the nearest boundary. Inside a zone, the distance is zero.

Reference price and its source should also be visible. A latest-candle close is an observation, not automatically a guaranteed exchange fill price. An agent must not silently convert one into the other when calculating an executable plan.

For each requested timeframe, the compact analytical output limits the nearest active zones by direction. That is a bounded analytical view, not a promise to expose every historical gap or a public all-market signal feed.

Multi-timeframe confluence is contextual

A bullish gap on a short timeframe can coexist with overhead resistance on a higher timeframe. A support-like gap does not cancel the resistance, and neither observation automatically decides the trade. The agent needs timeframe, zone relation, mitigation and broader structure to interpret the combination.

The multi-timeframe dealing-range article examines a related problem: the same price can occupy different relative locations in different ranges. The confirmed-versus-live structure article explains why an older confirmed event should not hide current price changes.

Avoid converting every confluence count into a confidence percentage. Three aligned observations are three observations; they do not establish a measured probability without a defined evaluation dataset.

Quality scores need honest labels

LiquidMind's versioned FVG quality model distinguishes formation quality from current usefulness after age and mitigation. Its score is a heuristic rank. It is explicitly unvalidated as a success probability.

Missing critical inputs yield an insufficient-data result and no numeric score. Optional volume absence affects confidence and weight normalization. A fallback numeric value would make missing evidence look like weak evidence, which is a different statement.

If a tool shows a quality score, ask what inputs produced it, which version computed it and whether any claim of predictive value has been independently evaluated. A neat 0–100 interface can obscure those questions.

From a scanner to an execution decision

Detection identifies a candidate zone. Agent interpretation evaluates whether it matters in current context. Technical planning and per-user risk checks determine whether a proposed action can progress. Exchange reconciliation determines what actually happened.

Explore FVG scanning inside LiquidMind and the ICT/SMC analysis workflow. The homepage demo action offers product exploration; demo sessions may restrict writes and full AI chat. Live workflows require appropriate account and venue access.

No pattern guarantees a fill or profitable reaction. FVG geometry does not prove institutional order placement, remove model error or establish a trading edge. Good analytical tooling makes those limits easier to see.

ShareX / TwitterThreads
sc4mp avatar

Public pen name of LiquidMind's founder and builder. Writing first-hand engineering notes and transparent performance reviews from the system's internal ledger.

Stay Liquid

New posts on transparency, engineering, and the LiquidMind thesis — no noise.

Loading discussion…