New Indicator + Tutorial: How traders use Fair Value Gaps (FVG)
Fair Value Gaps have become one of the most talked-about tools in trading over the last few years, especially among traders who follow “smart money” and market-structure concepts. Until now, finding them meant scrolling through charts or writing your own detection code. Today we’re adding the Fair Value Gap (FVG) indicator to TAAPI.IO, so you can detect gaps on any supported crypto pair or stock, on any timeframe, with a single request.
This post explains what a Fair Value Gap is, how traders use it, and walks you through three practical examples you can copy and run.
Endpoint: fvg
Optional inputs:
threshold(default:0): minimum gap size as a percentage of price. Smaller gaps are ignored.fillMode(default:wick): when an open gap counts as filled.wickmeans price touched the far edge;closemeans a candle closed beyond it.
What is a Fair Value Gap?
A Fair Value Gap is a price imbalance left behind by a strong, one-sided move. You find it by looking at three candles in a row:
- Bullish FVG: the low of the third candle is above the high of the first candle. The middle candle moved up so fast that the wicks of candles one and three never overlap. The empty space between them, from the first candle’s high up to the third candle’s low, is the gap.
- Bearish FVG: the high of the third candle is below the low of the first candle. The gap runs from the third candle’s high up to the first candle’s low.
The idea behind it: in that zone, price moved with almost no trading on the other side. Many traders expect price to come back and “rebalance” that area later. When it does, the gap is filled.
How traders use FVGs
There are three common approaches. Many traders combine them.
1. Entries on the retest. In an uptrend, a trader waits for price to pull back into the most recent unfilled bullish gap and looks for a long entry there, with a stop just below the gap. In a downtrend, it’s the mirror image: wait for a rally into a bearish gap, short, and put the stop just above it. The gap gives a clear, mechanical entry zone instead of chasing the move.
2. Targets and magnets. Unfilled gaps tend to act as price targets. If you’re long and there’s an open bearish gap above you, that’s a natural place to take profit, because price often reacts there. Likewise, a big unfilled gap below the current price warns that a pullback into it is possible.
3. Support, resistance and invalidation. An open bullish gap behaves like a support zone; an open bearish gap like resistance. When price closes straight through a gap, the zone has failed. Traders read that as a sign the momentum has changed, and as a reason to exit a trade that was built on that zone.
Most traders add a filter so they only trade gaps with the trend, for example only bullish gaps while price is above the 200 EMA. Gaps on higher timeframes (4h, 1d) are generally considered more meaningful than gaps on a 1-minute chart. We’ll use both ideas in the examples below.
Your first request
curl -G https://v2.taapi.io/indicator/fvg \
-H "Authorization: Bearer YOUR_API_KEY" \
--data-urlencode "exchange=binance" \
--data-urlencode "symbol=BTCUSDT" \
--data-urlencode "timeframe=1h" \
--data-urlencode "backtrack=1"
This is a real response:
{
"value": [0],
"top": [null],
"bottom": [null],
"bullishTop": [77662.91],
"bullishBottom": [77596.26],
"bullishTimestamp": [1793491200],
"bullishCount": [20],
"bearishTop": [78418],
"bearishBottom": [78241.3],
"bearishTimestamp": [1793343600],
"bearishCount": [11],
"timestamp": [1793548800]
}
Here’s how to read it:
valuetells you whether a gap was confirmed on this candle:1bullish,-1bearish,0none. When a gap forms,topandbottomgive its edges.bullishTopandbullishBottomare the edges of the most recent bullish gap that’s still unfilled, andbullishTimestamptells you when it formed (the middle candle). This is your current support zone.bearishTop,bearishBottomandbearishTimestampare the same for the most recent unfilled bearish gap, your current resistance zone.bullishCountandbearishCounttell you how many gaps of each kind are still open.
Why backtrack=1? Without it you get the candle that’s still forming. A gap on a forming candle can disappear before the candle closes, because its low or high can still change. backtrack=1 gives you the last closed candle, so every gap you see is confirmed. Once a gap is confirmed, it never changes: the indicator doesn’t repaint.
Example 1: Scan a watchlist for new gaps (Node.js)
Run this every time a 4h candle closes, and it tells you which coins just printed a new Fair Value Gap. It uses a single bulk request for the whole watchlist:
const API_KEY = 'YOUR_API_KEY';
const SYMBOLS = ['BTCUSDT', 'ETHUSDT', 'SOLUSDT', 'XRPUSDT', 'BNBUSDT'];
async function scan() {
const res = await fetch('https://v2.taapi.io/bulk', {
method: 'POST',
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${API_KEY}` },
body: JSON.stringify({
constructs: SYMBOLS.map((symbol) => ({
id: symbol,
exchange: 'binance',
symbol,
timeframe: '4h',
indicators: [{ id: 'fvg', indicator: 'fvg', threshold: 0.1, backtrack: 1 }]
}))
})
});
const data = await res.json();
for (const symbol of SYMBOLS) {
const fvg = data[symbol]?.fvg;
if (!fvg) continue;
const formed = fvg.value[0];
if (formed === 1) console.log(`🟢 ${symbol}: new bullish FVG ${fvg.bottom[0]} – ${fvg.top[0]}`);
else if (formed === -1) console.log(`🔴 ${symbol}: new bearish FVG ${fvg.bottom[0]} – ${fvg.top[0]}`);
else console.log(` ${symbol}: no new gap (${fvg.bullishCount[0]} bullish / ${fvg.bearishCount[0]} bearish still open)`);
}
}
scan();
Run it with Node.js 18 or newer (node scan.js). When we ran it, the output looked like this:
BTCUSDT: no new gap (8 bullish / 9 bearish still open)
ETHUSDT: no new gap (6 bullish / 15 bearish still open)
SOLUSDT: no new gap (7 bullish / 13 bearish still open)
XRPUSDT: no new gap (5 bullish / 15 bearish still open)
🟢 BNBUSDT: new bullish FVG 708.07 – 710.69
The threshold: 0.1 setting ignores gaps smaller than 0.1% of price. On liquid pairs, tiny gaps form all the time and are mostly noise, so a small threshold keeps your alerts meaningful. Raise it for volatile altcoins or lower timeframes.
How many symbols fit in one bulk request depends on your plan; see the pricing page.
Example 2: A trend-filtered retest alert (Node.js)
This combines the FVG with the two filters traders use most: the trend, measured by the 200 EMA, and the position of price relative to the latest open gap. It asks one question: did the last candle close inside an unfilled gap, in the direction of the trend?
const API_KEY = 'YOUR_API_KEY';
async function checkRetest(symbol, timeframe = '1h') {
const res = await fetch('https://v2.taapi.io/bulk', {
method: 'POST',
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${API_KEY}` },
body: JSON.stringify({
constructs: [{
id: 'c',
exchange: 'binance',
symbol,
timeframe,
indicators: [
{ id: 'fvg', indicator: 'fvg', threshold: 0.1, backtrack: 1 },
{ id: 'ema', indicator: 'ema', period: 200, backtrack: 1 },
{ id: 'price', indicator: 'price', backtrack: 1 }
]
}]
})
});
const { c } = await res.json();
const price = c.price.value[0];
const ema200 = c.ema.value[0];
const bullTop = c.fvg.bullishTop[0], bullBottom = c.fvg.bullishBottom[0];
const bearTop = c.fvg.bearishTop[0], bearBottom = c.fvg.bearishBottom[0];
if (price > ema200 && bullTop !== null && price <= bullTop && price > bullBottom) {
return `LONG setup: ${symbol} closed inside bullish FVG ${bullBottom} – ${bullTop}, stop below ${bullBottom}`;
}
if (price < ema200 && bearTop !== null && price >= bearBottom && price < bearTop) {
return `SHORT setup: ${symbol} closed inside bearish FVG ${bearBottom} – ${bearTop}, stop above ${bearTop}`;
}
return `${symbol}: no retest (close ${price}, EMA 200 ${ema200.toFixed(2)})`;
}
checkRetest('BTCUSDT').then(console.log);
All three indicators use backtrack: 1, so they describe the same closed candle. The stop level comes straight from the gap: if price closes through the far edge, the zone has failed and the setup is invalid.
From here it’s easy to extend: loop over a watchlist, add a take-profit at the nearest open gap on the other side, or send the message to Telegram or Discord instead of the console.
Example 3: Look back at recent gaps (Python)
Before trading gaps on a symbol, it helps to see how often they form and how many stay open. Use results to get the last 100 closed candles in one request:
from datetime import datetime, timezone
import requests
API_KEY = "YOUR_API_KEY"
resp = requests.get(
"https://v2.taapi.io/indicator/fvg",
headers={"Authorization": f"Bearer {API_KEY}"},
params={
"exchange": "binance",
"symbol": "ETHUSDT",
"timeframe": "1h",
"threshold": 0.1,
"results": 100,
"backtrack": 1,
},
)
fvg = resp.json()
for i, kind in enumerate(fvg["value"]):
if kind == 0:
continue
when = datetime.fromtimestamp(fvg["timestamp"][i], tz=timezone.utc)
label = "bullish" if kind == 1 else "bearish"
print(f"{when:%Y-%m-%d %H:%M} UTC {label:8} {fvg['bottom'][i]} – {fvg['top'][i]}")
print(f"Open now: {fvg['bullishCount'][-1]} bullish, {fvg['bearishCount'][-1]} bearish")
Part of the output when we ran it:
2026-10-29 21:00 UTC bearish 2294.88 – 2327.05
2026-10-30 01:00 UTC bearish 2228.16 – 2248.34
2026-10-30 04:00 UTC bullish 2219.44 – 2226.8
2026-11-01 01:00 UTC bullish 2257.27 – 2262.32
Open now: 6 bullish, 14 bearish
Every value in the series is calculated only from the candles up to that point, so you can use the same data to backtest a gap strategy without lookahead bias.
Tips for trading with the FVG indicator
- Filter the noise with
threshold. With the default of0, every gap counts, however small. On a 1h BTC chart that can mean 20 or more open gaps. Start with0.1to0.3and adjust per market. - Choose how strict “filled” should be.
fillMode=wickremoves a gap as soon as price touches its far edge.fillMode=closekeeps it until a candle closes beyond it, which ignores wicks that briefly poke through. Many traders prefercloseon lower timeframes. - Use closed candles for signals. Add
backtrack=1when you act on a gap, so it can’t disappear before the candle closes. - Prefer higher timeframes, and trade with the trend. A 4h or daily gap that lines up with the trend usually matters more than a 5-minute gap against it.
- Watch the counts. A rising
bearishCountwith few bullish gaps tells you sellers have been in control, which is useful context even when no setup is active.
As always, test a strategy on historical data before you trade it with real money. Fair Value Gaps are a tool for finding zones, not a guarantee that price will react there.
Where to go from here
- Full parameter and field reference: FVG documentation
- Combine FVGs with other indicators from the indicators library, such as EMA, Supertrend or RSI
- Fetch many symbols at once with bulk requests
The FVG indicator is available now on every plan. Give it a try, and if you build something with it, we’d love to hear about it: get in touch.