Choose a gap definition before comparing detectors
The sources use different tests. Thomas Bulkowski describes gaps between the shadows of the first two candles. TA-Lib's CDLXSIDEGAP3METHODS implementation compares real bodies and requires the third open inside the second body and third close inside the first. Its condition does not test a prior trend or a minimum body length. A match in one implementation can therefore be absent in another.
- Number the completed candles 1, 2 and 3, oldest first. O, H, L and C mean ordinary open, high, low and close.
- The worked specification below combines full-range separation with strict body containment. Its extra trend, body-size and tick thresholds are research choices, not a reproduction of TA-Lib or a TradingView built-in default.
| Gap measure | Downside | Upside |
|---|---|---|
| Real bodies, assuming the stated colors | C1 - O2 > 0 | O2 - C1 > 0 |
| Full high-low ranges | L1 - H2 > 0 | L2 - H1 > 0 |
| Gap interval for the full-range version | H2 to L1 | H1 to L2 |