stratester.com

Patterns · condition block

Fair value gap (FVG)

A fair value gap is a three-candle imbalance: price moved so fast that the first and third candles do not overlap. The block fires on the candle that completes the gap, if the gap is at least the size you set.

How the engine evaluates it

Bullish: the current candle's low is above the high of the candle two bars back. The gap is low[now] − high[2 back].

Bearish: the current candle's high is below the low of the candle two bars back. The gap is low[2 back] − high[now].

The gap is measured as a percentage of the current close and must be at least the minimum size. The block fires on the third candle only; it does not track whether the gap is later filled.

Formula
bullish gap = low[t] − high[t−2] > 0
bearish gap = low[t−2] − high[t] > 0
fires when gap / close × 100 ≥ minimum %

Botscript syntax

In the Lab you pick this block from the Patterns group and fill in its fields. In the code view the same condition is written like this:

fvg bullish 0.5%
fvg bearish 0.3%
fvg bullish

Settings

SettingValuesDefaultNotes
Directionbullish, bearishbullish—
Minimum size0 – 100%0.1%0 accepts any gap.
Timeframethe run's candles, or 15m, 30m, 1h, 2h, 4h, 6h, 12h, 1d, 1wthe run's candlesOptional. At least the run's candle size and a whole multiple of it.

On a higher timeframe

Add a timeframe at the end to read Fair value gap from bigger candles than the run uses, for example fvg bullish 0.5% on 4h. The engine builds those candles from the run's own candles (UTC, weeks start on Monday) and evaluates the block only on candles that have closed, so there is no look-ahead. Lengths and lookbacks count the bigger candles.

Fair value gap is an event on a higher timeframe: it fires once, on the run candle that closes the bigger candle where it happened, and is false on the other run candles.

The timeframe must be at least the run's candle size and a whole multiple of it; otherwise the run stops with an error and is not charged. Multi-timeframe conditions covers the details, including warm-up.

How traders use it

  • Momentum entries right after a bullish imbalance.
  • Exits when a bearish imbalance appears against your position.
  • Filter for decisive moves with a minimum size.

Example bot

botscript
bot "Imbalance Momentum"

when fvg bullish 0.4% and adx(14) > 20
then buy 50%

when fvg bearish 0.4%
then sell 100%
  • Buys after a bullish gap of at least 0.4% while ADX shows a trend.
  • Sells on a bearish gap of the same size.

Pitfalls

  • Many traders wait for price to come back into the gap. This block fires when the gap forms, not on the retest.
  • Small minimum sizes fire very often on low candle sizes.

Fair value gap: frequently asked questions

Which candle does the block fire on?

On the third candle, the one that completes the gap.

Does it know when a gap is filled?

No. It reports new gaps only. Use price-level or breakout blocks for what happens next.

How is the size measured?

As the gap in dollars divided by the current close, in percent.

Is an FVG the same as an imbalance?

Yes, the terms are used interchangeably in smart money concepts.

Simulated results are hypothetical. They include only the fee and slippage you set on the bot, not every real-world cost or market condition, and past performance does not guarantee future results. Nothing here is financial advice.