A pattern name is a lossy compression. "Engulfing," "harami," and "three white soldiers" are statements about where one bar's close sits relative to the bar before it. The name throws away the magnitude the moment it gets applied. According to most introductory material on candlestick patterns, you learn to recognize twelve to twenty shapes. Then you scan a chart for them. That works until a sequence shows up close to a named shape but not quite it. At that point the lookup-table approach has nothing left to say.
This piece replaces the lookup table with two numbers. Compute both on any three-bar sequence: where each bar's close sits inside the prior bar's range, and how that bar's range compares in size to the one before it. Learn those two measurements and every named pattern becomes a special case of a general rule. That includes the sequences that never got a name at all.
Two Numbers, Not One Name
Here is the whole method stated plainly. For any bar, compute two things against the bar immediately before it.
Close position is where this bar's close sits inside the prior bar's high-low range, expressed as a percentage: (close − prior_low) / (prior_high − prior_low) × 100. A close position of 100% means the close matched the prior high exactly. A close position of 0% means it matched the prior low. Above 100%, the close traded above the entire prior range. Below 0%, it closed under the prior low.
Range expansion is this bar's own high-low range divided by the prior bar's range: (high − low) / (prior_high − prior_low). A value of 1.0 means the two bars are the same size. A value of 2.0 means this bar's range is double the prior bar's. A value of 0.5 means it's half.
That's the entire methodology: no lookup table, no shape memorization, just two numbers per bar computed against the one before it. Every named reversal or continuation pattern from a trading course can be restated as a threshold on these two numbers. Once you see that, an unnamed sequence stops being a blank spot in your toolkit and becomes just another pair of numbers to read.
Worked Example: Read the Numbers First, Reveal the Name Second
Take a three-bar sequence on a hypothetical instrument. Bar 1 opens at 100, trades down to a low of 96, rallies to a high of 101, and closes at 97. That's a down bar with a range of 5 points. Bar 2 opens at 96.50, pushes to a high of 102.50, holds a low of 96.20, and closes at 102. That's an up bar with a range of 6.3 points. Bar 3 opens at 102.20, trades to 104, pulls back to 101.80, and closes at 103.60.
Run the two measurements on Bar 2 against Bar 1. Close position: (102 − 96) / (101 − 96) × 100 = 120%. The close traded above the entire prior range, not just at its top. Range expansion: 6.3 / 5 = 1.26. Bar 2's range is about a quarter larger than Bar 1's range.
Now run Bar 3 against Bar 2. Close position: (103.60 − 96.20) / (102.50 − 96.20) × 100 ≈ 117%. Range expansion: (104 − 101.80) / (102.50 − 96.20) = 2.2 / 6.3 ≈ 0.35. Bar 3 closed well above Bar 2's range. But it did so on a range barely a third the size of Bar 2's.
Only after computing both numbers does the name matter. Bar 2 relative to Bar 1 is a textbook bullish engulfing bar. Its body and its full range both clear the prior bar entirely, and the close position over 100% confirms it. Bar 3 relative to Bar 2 is a three-bar continuation print, a smaller-range follow-through that holds above the engulfing bar's close without retesting it. A trader who only knows the names sees "engulfing, then continuation" and stops there. A trader who ran the numbers also knows the continuation bar arrived on a much smaller range. That detail decides whether the move still has momentum or is already thinning out underneath a chart that still looks fine on the surface.
Four Named Patterns, Re-Derived as Measurement Rules
Once you accept that a pattern name is just a threshold on close position and range expansion, the standard library of shapes collapses into four short rules.
- Engulfing. Close position at or beyond 100% (bullish) or at or below 0% (bearish) against the prior bar, combined with range expansion above roughly 1.0. The body-only version some screeners use is a looser variant. It checks only the open/close pair instead of the full high/low range. See the breakdown in our engulfing candles study for how much that single definition choice moves outcomes in practice.
- Harami. The mirror image of engulfing on the expansion axis. Close position for the second bar lands between roughly 10% and 90% of the first bar's range, and range expansion comes in well under 1.0, often under 0.6. A harami is a containment event, not a breakout one. The second bar's entire range sits inside the first, so by definition its range expansion must shrink.
- Three-bar continuation. The third bar's close position against the second bar stays above roughly 60% in an uptrend, without a range expansion collapse below about 0.4. It's a hold, not a breakout. That's exactly the pattern Bar 3 showed against Bar 2 in the worked example above.
- Two-bar reversal. A sharp close-position flip: a bar that closed in the bottom third of its own range, followed by a bar that closes in the top third of that same prior bar's range, paired with range expansion near or above 1.0. This is the measurement signature behind several two-candle reversal names. They differ mainly in how extreme the flip is.
Per the CMT Association's classical charting coursework, the standard pattern library groups shapes by candle count and rough visual logic, rather than by a shared numeric test. That's one reason the same underlying measurement shows up under several different names, depending on which course taught it to you first.
The Near-Miss Problem: When the Name Says No and the Number Says Almost
Here's where the lookup-table method actually breaks. Take a bar that closes at a position of 92% against the prior bar's range, with a range expansion of 1.4. By a strict engulfing definition, this fails. The close needs to clear 100%, and 92% doesn't. A scanner built on pattern-matching logic returns nothing for this bar. A trader working from the measurement sees something different: a close eight points short of a full engulf, on a range 40% larger than the bar before it. That reads as functionally the same event, with slightly less follow-through on the close. The two numbers don't care whether a sequence clears an arbitrary 100% threshold. They tell you how close it came, and on what size range it happened.
This near-miss case is common. In practice, sequences cluster around the threshold far more than they sit cleanly on either side of it. A binary pattern name sorts most real sequences into "yes" or "no," when the honest answer is 87%, or 92%, or 104%. Treating the measurement as continuous, rather than the pattern as binary, is the single biggest practical gain of this method over the lookup-table approach. It's also why a near-miss sequence stops feeling like a dead end once you've run the numbers on a few of them.
Range Expansion Is the Half Everyone Drops
Most pattern descriptions define engulfing purely by close position and ignore range expansion almost entirely. They treat any bar that clears the prior close as the same event, regardless of size. That's a mistake. An engulfing bar with a range expansion of 0.5 barely squeezes a full close beyond the prior bar while trading on half the prior bar's range. An engulfing bar with a range expansion of 2.0 clears the same threshold while trading on double the volatility. Those are two different events wearing the same name.
In our experience walking through sequences this way, the low-expansion engulf tends to sit closer to a grind than a breakout. The close cleared the threshold, but the bar didn't trade with much conviction to get there. The high-expansion version usually coincides with a genuine volatility shift. Something changed about participation on that bar, not just about where it happened to close. Both get called "bullish engulfing" under a name-only read. Only one of them carries the range signature of an actual shift in how the instrument is trading that day.
Anchor the Read to Structure, Not Just the Two Bars
The two-number read tells you about the relationship between consecutive bars. It says nothing, on its own, about whether that relationship matters. The same measurement, say a close position of 115% with range expansion of 1.3, means something different depending on where it sits on the chart.
Before trusting any sequence read, check three locations against recent structure.
- At a swing extreme. The sequence prints at a prior swing high or swing low. This is where a measurement signature carries the most weight, because it's reacting to a level the market has already shown it respects.
- Mid-range. The sequence prints in open space, with no recent swing point or consolidation nearby. The same two numbers here are weaker evidence — the sequence is real, but it has nothing underneath it to react against.
- Inside a prior consolidation. The sequence prints within a range the instrument has already spent time building. This location sits between the other two — it carries more context than open air but less conviction than a clean swing extreme.
We built the measurement framework in this piece to stand on its own arithmetically. But structure is the filter that decides whether a given reading is worth acting on at all. Our market structure you can code piece covers how to define swing points and consolidation zones in rules a scanner can apply consistently. That's the natural companion check to run alongside close position and range expansion, not a replacement for either number.
Turning the Two Numbers Into an Alert Condition
Coding this as an alert is straightforward once the ordering is right, and the ordering is where almost every first attempt at this goes wrong. Close position and range expansion for the current bar must always be computed against the prior completed bar — the one immediately before the bar currently forming — never against the forming bar itself.
Here's the trap: on an intraday chart, a bar is "live" until its session or interval closes. If an alert condition recalculates close position against a bar that hasn't finished printing yet, the high and low used in the denominator keep changing with every tick, and the percentage swings wildly in a way that has nothing to do with the actual sequence. The fix is a one-line guard most scripting environments support directly: reference the prior bar's values with an offset of one bar back from the bar currently being evaluated, and only evaluate the condition once that reference bar is fully closed.
A minimal rule set for a two-bar alert, stated as pseudocode:
close_position = (close[0] − low[1]) / (high[1] − low[1]) × 100range_expansion = (high[0] − low[0]) / (high[1] − low[1])fire_alert = close_position >= 100 AND range_expansion >= 1.0(bullish engulf-class condition)
Here, index 0 is the bar being evaluated and index 1 is the one immediately before it. Both must be fully closed before the condition runs. Our own data from building scanners this way shows the single most common bug isn't a math error. It's an off-by-one reference that pulls the forming bar's still-changing high or low into the denominator, and it usually shows up as an alert that keeps re-firing on the same bar as price ticks around.
Why This Beats the Lookup-Table Approach
Every page that ranks for "how to read trading candlesticks" hands you a table of named shapes with a picture next to each one. None of them teaches a measurement that covers a sequence outside the table. That's the gap this piece is built to close. It's a two-number read that works on any three-bar sequence, including the ones that don't match any named shape closely enough to get flagged by a pattern scanner. The named patterns aren't wrong. They're useful shorthand for specific regions of the close-position and range-expansion space. But shorthand that only covers part of the space leaves the near-miss sequences, which show up constantly, with no framework at all. Compute the two numbers first. Let the name follow, if one applies, instead of leading the read.
Think of the four re-derived rules above less as a replacement vocabulary and more as four labeled regions on a two-dimensional map, where close position is one axis and range expansion is the other. A sequence doesn't need to land inside a labeled region to be worth reading. It just needs its coordinates computed. Most of what a trader actually sees, over enough sessions, falls somewhere between the labeled regions rather than cleanly inside one, which is exactly why the measurement matters more than the catalogue of names built on top of it.
A caution worth stating plainly: everything above is a historical measurement framework applied to fixed examples, not a trading signal or a forecast. Quantzee builds analytical software, not advisory services, and nothing in this piece is investment advice or a guarantee of any outcome. Per the U.S. SEC's Office of Investor Education guidance on evaluating technical approaches, a pattern's past behavior on a sample of bars does not predict how the next sequence will resolve. Paper trade any alert condition built from this framework for a meaningful stretch before committing real capital to it, and treat every close-position or range-expansion threshold above as a starting point to test against your own instrument and timeframe, not a fixed rule to apply blindly.
