fair_value_gaps

forge.tafunctionSince Forge API 1
Signaturepython
forge.ta.fair_value_gaps(open_: ArrayLike,high: ArrayLike,low: ArrayLike,close: ArrayLike,min_size: float = 0.0,auto_threshold: bool = True,threshold_bars: int = 100,threshold_mult: float = 2.0,extend: int = 0,mitigation: str = 'filled') -> dict[str, np.ndarray | Zone]

Three-candle gaps, newest first in five slots per side, until price fills them.

Parameters

NameTypeDefault
open_ArrayLike
highArrayLike
lowArrayLike
closeArrayLike
min_sizefloat0.0
auto_thresholdboolTrue
threshold_barsint100
threshold_multfloat2.0
extendint0
mitigationstr'filled'

Indicator: Fair value gaps

A bullish gap forms on a bar whose low is above the high two bars earlier, when the bar between them closes above that high; it runs from that high up to the low. A bearish gap mirrors it. A gap is kept when its height is at least min_size and, with auto_threshold, when the middle candle's body is larger than threshold_mult times the average body of the threshold_bars candles before it. mitigation says whether price must trade through the whole gap (filled) or into it (touched); with extend above zero a gap is removed that many bars after it formed. The parameter is spelled open_ because open is a Python builtin.