Fai Value Gap indicator for your forex scalping strategy
Posted: Thu Jul 30, 2026 7:22 pm
Hi scalpers,
today i would like to share with you another interesting indicator, which can be usefull for your forex scalping.
It is called Fair Value Gap (FVG).
The Fair Value Gap (FVG) is a popular price action concept rooted in Smart Money Concepts (SMC), highly effective for forex scalping. An FVG represents an inefficiency or imbalance in the market, occurring when a sudden surge in buying or selling pressure causes the price to move so rapidly that liquidity isn't evenly distributed.
Visually, an FVG is identified using a three-candle sequence. A bullish FVG forms when the high of the first candle fails to overlap with the low of the third candle, leaving a gap across the body of the large second candle. Conversely, a bearish FVG occurs when the low of the first candle does not overlap with the high of the third candle during a sharp downtrend.
For forex scalpers operating on lower timeframes like the 1-minute (M1) or 5-minute (M5) charts, these gaps serve as magnetic zones. The core premise is that the market naturally seeks efficiency and will frequently retrace to "fill" or rebalance these gaps before continuing its original trend. Scalpers can place limit orders or wait for price action confirmation within the FVG zone to enter high-probability trades with tight stop losses.
When scalping, relying solely on FVGs can be risky due to market noise. The highest probability setups occur when an FVG aligns with other confluences, such as a liquidity sweep, a break of market structure (BMS), or an order block. By utilizing a custom indicator to automatically draw these zones, scalpers save crucial time, allowing them to focus purely on execution and risk management in fast-moving markets.
MT4 Fair Value Gap (FVG) Indicator Code
Here is a lightweight MQL4 indicator that automatically identifies and draws rectangles over Bullish and Bearish Fair Value Gaps on your chart.
To use this, open MetaEditor in MT4, create a new Custom Indicator, and paste the code below.
today i would like to share with you another interesting indicator, which can be usefull for your forex scalping.
It is called Fair Value Gap (FVG).
The Fair Value Gap (FVG) is a popular price action concept rooted in Smart Money Concepts (SMC), highly effective for forex scalping. An FVG represents an inefficiency or imbalance in the market, occurring when a sudden surge in buying or selling pressure causes the price to move so rapidly that liquidity isn't evenly distributed.
Visually, an FVG is identified using a three-candle sequence. A bullish FVG forms when the high of the first candle fails to overlap with the low of the third candle, leaving a gap across the body of the large second candle. Conversely, a bearish FVG occurs when the low of the first candle does not overlap with the high of the third candle during a sharp downtrend.
For forex scalpers operating on lower timeframes like the 1-minute (M1) or 5-minute (M5) charts, these gaps serve as magnetic zones. The core premise is that the market naturally seeks efficiency and will frequently retrace to "fill" or rebalance these gaps before continuing its original trend. Scalpers can place limit orders or wait for price action confirmation within the FVG zone to enter high-probability trades with tight stop losses.
When scalping, relying solely on FVGs can be risky due to market noise. The highest probability setups occur when an FVG aligns with other confluences, such as a liquidity sweep, a break of market structure (BMS), or an order block. By utilizing a custom indicator to automatically draw these zones, scalpers save crucial time, allowing them to focus purely on execution and risk management in fast-moving markets.
MT4 Fair Value Gap (FVG) Indicator Code
Here is a lightweight MQL4 indicator that automatically identifies and draws rectangles over Bullish and Bearish Fair Value Gaps on your chart.
To use this, open MetaEditor in MT4, create a new Custom Indicator, and paste the code below.
Code: Select all
//+------------------------------------------------------------------+
//| FVG.mq4 |
//| Copyright 2026, Your Name |
//+------------------------------------------------------------------+
#property copyright "Your Name"
#property link ""
#property version "1.00"
#property indicator_chart_window
//--- Input parameters
input color BullishColor = clrLightGreen; // Color of Bullish FVG
input color BearishColor = clrLightCoral; // Color of Bearish FVG
input int MaxBars = 500; // Number of past bars to scan
input int ExtendBars = 10; // How many bars forward to extend the box
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
// Remove all FVG boxes when indicator is removed
ObjectsDeleteAll(0, "FVG_");
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
// Determine how many bars to scan
int limit = rates_total - prev_calculated;
if(limit > MaxBars) limit = MaxBars;
if(limit <= 2) return(rates_total);
// Loop through historical bars
for(int i = limit; i >= 1; i--)
{
// Ensure we have enough bars for a 3-candle formation
if(i + 2 >= rates_total) continue;
double gapTop = 0;
double gapBottom = 0;
bool isBullish = false;
bool isBearish = false;
// Check for Bullish FVG (Low of candle 1 > High of candle 3)
// Note: In MT4, index 0 is the current candle. i=1, i+1=2, i+2=3
if(low[i] > high[i+2])
{
isBullish = true;
gapTop = low[i];
gapBottom = high[i+2];
}
// Check for Bearish FVG (High of candle 1 < Low of candle 3)
else if(high[i] < low[i+2])
{
isBearish = true;
gapTop = low[i+2];
gapBottom = high[i];
}
// Draw the rectangle if an FVG is found
if(isBullish || isBearish)
{
string objName = "FVG_" + TimeToString(time[i+1]);
// Only draw if it doesn't already exist
if(ObjectFind(0, objName) < 0)
{
datetime endTime = time[i] + (PeriodSeconds() * ExtendBars);
ObjectCreate(0, objName, OBJ_RECTANGLE, 0, time[i+2], gapTop, endTime, gapBottom);
ObjectSetInteger(0, objName, OBJPROP_COLOR, isBullish ? BullishColor : BearishColor);
ObjectSetInteger(0, objName, OBJPROP_BACK, true); // Keep behind candles
ObjectSetInteger(0, objName, OBJPROP_FILL, true); // Fill the box with color
ObjectSetInteger(0, objName, OBJPROP_SELECTABLE, false);
ObjectSetInteger(0, objName, OBJPROP_HIDDEN, true);
}
}
}
return(rates_total);
}
//+------------------------------------------------------------------+