Read the five candles in order
The reference here is the open-source TA-Lib CDLLADDERBOTTOM implementation. O, H, L and C mean ordinary open, high, low and close. Black or red means C < O; white or green means C > O. Colors depend on chart settings, so compare prices rather than pixel colors.
- TA-Lib does not test the preceding downtrend. It also does not require candle 4 to extend the sequence of lower opens and closes, or require candle 5 to gap above the entire fourth high-low range.
- An upper wick on candle 4 means its close remained below an earlier traded high. It does not prove rejection of the low, identify who traded, or reveal the intrabar order of high and low. The fifth-bar recovery supplies the later evidence for the reversal hypothesis.
- Three White Soldiers is a different three-bullish-candle sequence. Neither three rising candles nor an arbitrary five-candle bounce replaces the four-bearish-then-one-bullish structure here.
| Candle | Required relationship | What it establishes |
|---|
| 1 | C1 < O1 | First bearish body |
| 2 | C2 < O2; O2 < O1; C2 < C1 | Lower open and close |
| 3 | C3 < O3; O3 < O2; C3 < C2 | Another step down |
| 4 | C4 < O4; an upper shadow above max(O4, C4) | A rally occurred within this bearish bar |
| 5 | C5 > O5; O5 > O4; C5 > H4 | An opening above the fourth body and a close beyond its high |
Configure a detector without hiding the definition
Use the following custom research settings to turn the description into reproducible tests. These numerical defaults are illustrative choices, not TA-Lib defaults or established optimal settings. Evaluate only completed candles and keep a versioned record of every setting.
- Keep the first-three lower-open and lower-close comparisons strict. Equal opens or closes fail. Treat dojis as failures rather than assigning them a direction from chart color.
- Validate finite OHLC, H >= max(O, C), L <= min(O, C), a positive tick size and enough prior history. Use the instrument tick grid. A missing bar or insufficient history is unavailable data, not a confirmed absence.
- TA-Lib compares the fourth upper shadow with its configurable ShadowVeryShort candle setting. The fixed fraction above is a different rule. To compare detectors, match their shadow calculation instead of assuming that the same pattern name means the same events.
- Descriptions that require long first-three bodies need another explicit threshold. One possible variant is body size >= 0.5 × the mean high-low range of the 10 bars immediately preceding candle 1. Freeze that reference for the entire candidate and record the extra history requirement; it is not enabled in this example.
| Setting | Example default | Exact test |
|---|
| Trend lookback N | 5 closes before candle 1 | Within the N-close sequence, each close after the first is lower than its predecessor; N >= 2 |
| Minimum body m | 2 ticks | abs(C - O) >= m × tick size for all five candles; m >= 1; retain the required direction |
| Upper-shadow fraction s | 0.20 | (H4 - max(O4, C4)) / (H4 - L4) >= s; 0 <= s <= 1; require a positive upper shadow and H4 > L4 |
| Opening buffer g | 1 tick | O5 >= O4 + g × tick size; g >= 1 |
| Closing buffer b | 1 tick | C5 >= H4 + b × tick size; b >= 1 |
| Fourth lower step | Off | If enabled, additionally require O4 < O3 and C4 < C3 |
| Full-range opening gap | Off | If enabled, additionally require O5 >= H4 + g × tick size |
| Confirmation window W | 5 following bars | W >= 1; inspect bars 6 through 10 at the default; do not silently extend the window |
Recalculate a five-bar OHLC example
These invented prices use a 0.01 tick. The five closes immediately before candle 1 are 110, 109, 108, 107 and 106, so the chosen trend filter passes. Use the default settings above. The example is a geometry test, not a historical signal or trade.
- The first three opens are 105 > 103.5 > 101.5, and their closes are 103 > 101 > 99. All four initial bodies are bearish; candle 5 is bullish.
- Candle 4 body size is 99.5 - 98.8 = 0.7. Its upper shadow is 101 - 99.5 = 1.5 and its range is 101 - 98 = 3, giving 1.5 / 3 = 50%. This exceeds the 20% threshold. Its lower shadow is only 0.8; that measurement is not the defining shadow test.
- The smallest body is 0.7, above the 0.02 minimum. Candle 5 opens at 100, above the required 99.51, and closes at 102, above the required 101.01. The default candidate passes.
- The optional fourth-lower-step rule also passes. The optional full-range opening-gap rule fails: O5 = 100 is below H4 + 0.01 = 101.01. A gap above the body is not a gap above every wick.
| Bar | Open | High | Low | Close |
|---|
| 1 | 105 | 105.5 | 102.5 | 103 |
| 2 | 103.5 | 104 | 100.5 | 101 |
| 3 | 101.5 | 102 | 98.5 | 99 |
| 4 | 99.5 | 101 | 98 | 98.8 |
| 5 | 100 | 102.5 | 99.7 | 102 |
Keep confirmation and failure on the bars where they happen
For a separate follow-through experiment, save U = max(H1, H2, H3, H4, H5) and D = min(L1, L2, L3, L4, L5) at candle 5 close. During the next W completed bars, the first close >= U + one tick confirms upward follow-through; a first close <= D - one tick invalidates the candidate before confirmation. This full-pattern breakout is an additional research rule, not part of the five-bar detector.
- For confirmed candidates, a separate five-bar follow-up window can record a later close <= D - one tick as failure. The last row meets that rule. An incomplete dataset must remain incomplete, not be counted as a successful hold.
- Here C5 = 102 remains 3.51 below the confirmation threshold. Completing candle 5 does not mean price has recovered the entire formation. A stronger confirmation filter delays the event and changes the available entry price.
- A close-based label cannot guarantee an order fill at that close or at a stop threshold. Gaps, spreads, fees and intrabar stop/target ordering need explicit assumptions in any later strategy test.
| Alternative path | Result for this example |
|---|
| Candle 6 high 106, close 105.40 | Pending: a wick above U = 105.5 is insufficient |
| Candle 6 close 105.50 | Pending: equality misses the 105.51 threshold |
| Candle 6 close 105.51 | Confirmed at candle 6 close |
| Candle 6 low 97.80, close 98.20 | Pending: wick crosses D = 98 but the close does not |
| Candle 6 close 97.99 | Invalidated before upward confirmation |
| Bars 6 through 10 close within 98 to 105.5 | Expired unconfirmed; a breakout on bar 11 is late |
| Candle 6 closes 105.51; candle 7 closes 97.99 | Confirmed, then failed; retain both timestamps |
Use rejected cases and small samples as checks
Change one input at a time to test the detector. With the example above, changing only O5 to 99.50 fails the opening buffer; changing only C5 to 101.00 fails the closing buffer. Setting the upper-shadow fraction to 0.50 still passes, while 0.51 fails. Replacing the preceding closes with 106, 107, 106, 107 and 106 leaves the shape intact but fails the trend filter.
- Report eligible windows, raw shapes, trend-filtered candidates, confirmed cases, invalidations, expiries and incomplete observations separately. A confirmation percentage whose denominator excludes expired events can conceal how few candidates actually confirm.
- With only 20 completed candidate observations, one changed classification moves the share by 1 / 20 = 5 percentage points. This arithmetic example is not a measured ladder bottom success rate. A few visually convincing charts cannot establish an advantage.
- TA-Lib describes the pattern as rare and cites a historical study. Its frequency cannot be assumed for a different market, timeframe, session or custom shadow threshold. Keep zero detections in the results rather than relaxing settings until a signal appears.
- Group overlapping detections and retain the symbol, timeframe, dates, session and adjustment settings. Several events during one selloff do not provide the same independence as unrelated observations. Choose settings before evaluating held-out history.
Review the rules and screenshots before adding orders
Give Pine Script AI Coding Agent the five-candle table, parameter defaults, optional variants and rejected examples. Request separate candidate, confirmation, invalidation and expiry markers with their actual bar timestamps. Inspect the generated conditions, validate syntax and compare each boundary case before using the detector on a chart.
- Use ordinary price candles for the OHLC comparisons. TradingView documents Heikin-Ashi prices as synthetic; applying these rules to transformed candles answers a different question.
- Upload readable accepted and rejected chart screenshots to AI Chart Analysis to review the visible decline and sequence. Include enough history before candle 1. Check exact prices in TradingView because a screenshot cannot reliably settle a one-tick threshold or reveal hidden bars.
- Only after the written cases agree with detector output should you define position sizing, entries, exits and execution costs for strategy testing. This page supplies a configurable specification and worked examples; it does not run a live scan or report a backtest.