Use this article to understand the bullish ICT Fair Value Gap template block by block. This is not a full trading strategy recommendation. It is a strategy component that detects a bullish Fair Value Gap, stores the relevant price levels in variables, and places a pending buy order from the stored FVG level. Also known as: ICT FVG, bullish Fair Value Gap, FVG block, FVG template, Candle ID 1 2 3, BullFVGHigh, BullFVGLow, pending order at FVG.
Summary
The bullish ICT Fair Value Gap template uses two separate decision trees:
The first decision tree detects a valid bullish Fair Value Gap and stores its price boundaries.
The second decision tree uses the stored price level to place a pending buy order.
The main idea is simple:
The template first checks a three-candle structure. If the structure is valid, it saves the Fair Value Gap boundaries into variables. Later, the EA uses those stored values to place a pending order at the Fair Value Gap level.
This separation is important because the EA needs to remember the detected price zone before it can trade from it.
Video explainer: https://youtu.be/ojBsjbvNuA4?si=_8kBXZk01iIGUSj-&t
What the template does
The template focuses on a bullish, or buy-side, Fair Value Gap.
A bullish Fair Value Gap is defined with three closed candles:
Candle ID 1 low = upper boundary of the gap
Candle ID 3 high = lower boundary of the gap
In this template:
BullFVGHighstores the upper boundary of the bullish FVGBullFVGLowstores the lower boundary of the bullish FVG
Important: BullFVGHigh does not mean the candle high. It means the higher price boundary of the gap. In this bullish template, that value comes from Candle ID 1 low.
This template requires a pro subscription
How Candle IDs work in this template
The template uses closed candles, not the current forming candle.
The Candle IDs are:
Candle ID 0 = current candle that is still forming
Candle ID 1 = most recent fully closed candle
Candle ID 2 = the closed candle before Candle ID 1
Candle ID 3 = the closed candle before Candle ID 2
This matters because Candle ID 0 can still change while price moves. Candle ID 1, 2, and 3 are already closed, which makes the logic cleaner and easier to test.
Example:
If you run the EA on the 1H timeframe, the Run per Candle block checks the logic once when a new 1H candle starts.
The two decision trees
The template has two separate decision trees.
The left decision tree detects and stores the Fair Value Gap.
The right decision tree checks whether a stored FVG level exists and places the pending order.
This is the core structure:
Detection → Store price levels → Check stored level → Place pending order → Reset variables
Decision tree 1: Detect and store the Fair Value Gap
The first decision tree looks for a valid bullish Fair Value Gap.
It runs once per candle and checks several Trade Rule blocks. If all conditions are true, the EA stores the FVG boundaries in variables.
1. Run per Candle
The first block is Run per Candle.
This means the detection logic runs once when a new candle forms.
If the EA is attached to a 1H chart and the block uses the Current timeframe, this tree runs once at the start of each new 1H candle.
This prevents the same closed-candle pattern from being checked repeatedly on every tick.
2. Trade Rule: Measure the wicks
Condition:
Candle ID 1 low > Candle ID 3 high
Plain English:
The low of the most recent closed candle is higher than the high of Candle ID 3.
This creates the basic bullish Fair Value Gap area.
The gap sits between:
Candle ID 1 low
Candle ID 3 high
This is the first structural requirement. If Candle ID 1 low is not above Candle ID 3 high, there is no bullish gap according to this template logic.
3. Trade Rule: Bullish impulse candle
Condition:
Candle ID 2 close > Candle ID 2 open
Plain English:
Candle ID 2 must be bullish.
This means the candle closed above its own open.
The template uses this as a simple way to define bullish impulse. It checks whether the middle candle moved upward.
This is intentionally simple. You can make this stricter later by adding your own impulse definition, for example with a stronger candle body requirement, range filter, trend filter, or other price-action condition.
4. Trade Rule: Simple impulse confirmation
Condition:
Candle ID 1 high > Candle ID 2 high
Plain English:
The most recent closed candle made a higher high than the candle before it.
This confirms that price continued pushing upward after the bullish impulse candle.
This is a simple momentum check. It does not mean this is the only way to define an impulse. It is just a clean and testable price-action rule.
5. Trade Rule: Liquidity Grab / FVG validity check
Condition:
Candle ID 2 low > Candle ID 3 low
Plain English:
The low of Candle ID 2 must be higher than the low of Candle ID 3.
The block name “Liquidity Grab” may sound advanced, but in this template it mainly works as an additional validity check.
It helps confirm the bullish structure and keeps the Fair Value Gap definition cleaner.
6. Modify Variables: Store the FVG boundaries
If all previous Trade Rule blocks are true, the template stores the detected FVG price levels in variables.
The variables are:
BullFVGHigh= Candle ID 1 lowBullFVGLow= Candle ID 3 high
This is where the EA remembers the Fair Value Gap.
Variables work like dynamic memory containers. They can store values while the EA is running and use those values later in another part of the strategy.
In this template, the variables create the bridge between detection and execution.
The first tree finds the Fair Value Gap. The variables remember the price levels. The second tree uses those stored levels to place the order.
This is also why this template is more advanced than a simple entry template. It does not only check a condition and trade immediately. It detects a price zone, stores it, and then uses that zone later.
The same pattern can be used for other strategies too. You can store session highs and lows, swing points, candle levels, supply and demand zones, or any other price area you want to use later.
Decision tree 2: Place the pending order from the stored FVG level
The second decision tree checks whether a valid FVG level has been stored.
If the stored level exists and the trade filters are clear, the EA places a buy pending order at the stored FVG level.
1. Run per Candle
The second tree also starts with Run per Candle.
This means the EA checks once per new candle whether it should use the stored FVG level for order placement.
This could technically be checked per tick, but per candle is usually enough in this template because the EA places a pending order. Once the pending order is placed, it waits in the market until price reaches it or the order is removed.
2. Trade Rule: Variable is defined
Condition:
BullFVGHigh != 0
Plain English:
The EA checks whether a valid FVG entry level has already been stored.
If BullFVGHigh is still 0, the EA has no FVG level to trade from.
This prevents the EA from placing a random pending order before a Fair Value Gap has been detected.
3. Count Trades
The Count Trades block checks whether there are already open trades or pending orders.
The purpose is exposure control.
The template only wants one active trade or order at a time. Without this check, the EA could keep adding pending orders whenever new FVGs appear.
This block helps prevent duplicate entries and accidental order stacking.
4. Trade Rule: Price is above Fair Value Gap
Condition:
Current market price > BullFVGHigh
Plain English:
The EA checks whether the current price is still above the stored FVG entry level.
For a bullish FVG pullback entry, the pending buy order should be placed below the current price at the stored FVG level.
This block acts as a safety check before placing the pending order.
If price is not above BullFVGHigh, the setup is no longer in the expected position for this specific entry logic.
5. Buy Pending Order
Open Price Level:
Custom Price Level = BullFVGHigh
Plain English:
The EA places a buy pending order at the stored upper boundary of the bullish Fair Value Gap.
Because BullFVGHigh stores Candle ID 1 low, the pending buy order is placed at that exact price level.
In this template, the order is usually placed as a buy limit because the current price should be above BullFVGHigh when the order is created.
The Buy Pending Order block automatically decides whether the order is a buy limit or buy stop based on the open price relative to the current market price.
Stop loss and take profit in the example template
The example template places the stop loss around Candle ID 3 low.
The take profit uses a simple fixed risk-reward structure, for example 300% of the stop-loss distance.
These are example settings only.
They are not a recommendation. You should backtest and adjust the stop loss, take profit, and risk model before using the logic in any live environment.
6. Modify Variables: Reset the stored FVG values
After the pending order is placed, the template resets the variables.
Reset:
BullFVGHigh = 0BullFVGLow = 0
This matters.
Once the pending order has been placed, the EA no longer needs the stored FVG level for that setup. Resetting the variables prevents the EA from placing repeated orders from the same old FVG zone.
After the reset, the EA waits for a fresh Fair Value Gap to be detected.
Why the template uses two decision trees
The template uses two decision trees because detection and execution are separate jobs.
The first tree answers:
“Do we have a valid bullish Fair Value Gap?”
The second tree answers:
“Do we have a stored FVG level, and should we place a pending order from it?”
This makes the logic cleaner:
Detection happens first
The FVG boundaries are stored in variables
The entry tree uses the stored level later
Count Trades prevents duplicate exposure
Resetting variables prevents repeated entries from the same setup
Without this separation, the EA would be harder to control and debug.
Why variables are used
Variables are used because the EA needs memory.
The detection tree finds the FVG boundaries at one moment in time. The order placement tree may use those values later.
The variables connect those two steps.
In this template:
BullFVGHighstores the entry levelBullFVGLowstores the lower boundary of the gap
This allows the EA to detect a price zone first and use it later for execution.
Main blocks used
Run per Candle
Runs the connected logic once when a new candle forms.
Used here to check the FVG logic once per candle instead of on every tick.
Trade Rule
Compares two values.
Used here to check candle lows, candle highs, candle opens, candle closes, and stored variable values.
Modify Variables
Stores or resets values.
Used here to save BullFVGHigh and BullFVGLow, then reset them after the pending order is placed.
Count Trades
Counts existing trades or orders.
Used here to prevent multiple active trades or pending orders from stacking.
Buy Pending Order
Places a future buy order at a defined price level.
Used here to place the pending buy order at BullFVGHigh.
Common mistakes
1. Mixing up Candle ID 0 and Candle ID 1
Candle ID 0 is still forming.
This template uses closed candles: Candle ID 1, Candle ID 2, and Candle ID 3.
That makes the logic easier to test and avoids using values from a candle that can still change.
2. Thinking BullFVGHigh means the candle high
It does not.
In this bullish FVG template, BullFVGHigh means the upper boundary of the gap.
That value is Candle ID 1 low.
3. Thinking BullFVGLow means the candle low
It does not.
In this bullish FVG template, BullFVGLow means the lower boundary of the gap.
That value is Candle ID 3 high.
4. Removing Count Trades
Do not remove Count Trades unless you understand the consequence.
Without Count Trades, the EA may place several pending orders or stack multiple trades.
That can quickly make the backtest harder to read and increase exposure in ways you did not intend.
5. Not resetting variables
If the variables are not reset after order placement, the EA may continue using old FVG levels.
That can cause repeated order placement from a level that should no longer be active.
6. Treating this as a complete profitable strategy
This template is a logic component.
It helps you detect and trade from a bullish Fair Value Gap, but it does not guarantee profitability.
You still need to test and improve the logic. Common additions include trend filters, session filters, spread filters, risk settings, and stricter entry or exit rules.
How to test it in MT5 Visual Mode
Use MT5 Visual Mode to check whether the EA behaves as expected.
Look for these points:
Does the pending order appear only after the three-candle FVG logic is valid?
Is the order placed at the
BullFVGHighlevel?Is the stop loss placed where expected?
Are old variables reset after the order is placed?
Does Count Trades prevent duplicate orders?
Does the EA wait for a fresh FVG after the variables are reset?
Testing visually is important because the block logic can look abstract in the Builder. Visual Mode lets you connect the block conditions to the actual candles on the chart.
How to make it your own
This template gives you a starting structure.
You can adjust:
how the impulse candle is defined
whether Candle ID 2 close must be above Candle ID 2 open
whether price must make a stronger higher high
whether trend filters should be added
whether session filters should be added
whether spread filters should be added
where the pending order is placed
how the stop loss is calculated
how the take profit is calculated
which risk model is used
whether old pending orders should be deleted or replaced when a new FVG appears
The best approach is to change one part at a time, export the EA, and test the difference in MT5.
Do not change five rules at once. If performance changes, you will not know which rule caused it.
Example template
Conclusion
The ICT Fair Value Gap template is built around a simple mechanical workflow.
It detects a bullish three-candle Fair Value Gap, stores the gap boundaries in variables, checks whether the stored level is valid for entry, places a pending buy order, and then resets the variables.
The most important part to understand is the separation between detection and execution.
The first decision tree finds and stores the FVG.
The second decision tree trades from the stored FVG level.
Once you understand that structure, you can reuse the same logic for many other price zones and strategy components.
Templates are for educational purposes only. Always backtest, validate, and adjust your logic before using it in live trading.




