Harami describes a smaller second real body contained in a larger first one. The name means “pregnant” in Japanese. A bullish version is considered after a decline and a bearish version after an advance. Distinguish body from full High–Low range, define “large” and “small”, and state the chosen colour, edge-equality and context rules. The shape does not prove a reversal or reveal participants’ intentions.

Body containment and color are separate rules

The second candle’s body can occupy the same interval in opposite directions. If your strategy requires opposite colors, record that separately.

Scroll sideways to see the full diagram

Body containment and color are separate rulesThe fictional first candle is Open 100, High 101, Low 89, Close 90. Second-candle variant A is Open 93, High 97, Low 92, Close 96; variant B is Open 96, High 97, Low 92, Close 93. Both have body [93, 96] within the first [90, 100], with identical High/Low. A has the opposite color to the first; B the same. A and B are alternatives, not third and fourth consecutive candles.Same inner body, different colorA and B are variants of the second candle.9095100FirstVariant AVariant BA: Open 93 → Close 96; body [93; 96]B: Open 96 → Close 93; body [93; 96]

Our own data: Arbitrary price units. A and B are alternative second candles after the same first record. The first body is [90; 100], length 10; both variants have body [93; 96], length 3. Their length ratio is 3 / 10 = 30% in both cases.

Our additional rule is: “the second candle has the opposite color to the first.” The first falls. A rises and passes this filter; B falls and fails it. Body containment gives the same answer in both variants.

TA-Lib’s CDLHARAMI code does not require an opposite-colored second body here. It also uses “long” and “short” conditions dependent on settings and history. We have not supplied that history, so we do not calculate the complete function result. The color filter explicitly belongs to our rule; it is not a universal Harami definition or a promise of better results.

Identical body placement need not give the same result under our custom color filter.
Candle/variantOpenHighLowClose
First1001018990
Second A93979296
Second B96979293

What exactly is the harami pattern?

The real body spans Open to Close; the full range spans Low to High. Our exercise requires strict containment: both second-body endpoints lie inside the first body without touching its edges. Second-candle shadows do not enter this particular condition. Thus a harami body can coexist with a second High above the first or Low below it, failing a full-range inside-bar test.

For our own model choose opposite colours: bullish harami has a falling first candle and rising second after a decline; bearish harami reverses those colours after an advance. TradingView describes these opposite-colour variants and allows SMA50, SMA50/SMA200 or no trend detection. TA-Lib’s CDLHARAMI instead does not require the second colour or check trend. Different labels can reflect different definitions rather than bad data.

One name, different detector conditions

Define size numerically before selecting examples. For our own exercise require the first body to be at least 1.5 times the mean body of ten completed preceding candles, and the second to be nonzero and at most half the first. These are arbitrary model settings, not TA-Lib defaults or validated optimal parameters. With a prior mean 40 pips the large-body threshold is 60 pips; a 100-pip first body passes, and a 30-pip second body is below its 50-pip limit. Exclude both pattern candles from that chosen prior mean.

TA-Lib C 0.6.4 uses two different adaptive reference windows. Keep a fictional pair 100/102/88/90 and 93/96/92/96 unchanged: bodies 10 and 3 with strict containment in 90–100. Prepend 12 candles O/H/L=100/106/94 and C=102 or 104. Only preceding closes change.

Same pair, different prior body means
Earlier bodiesSecond-body referenceOur half-first limitCDLHARAMI
All 2(9×2+10)/10=2.83≤5: pass0
All 4(9×4+10)/10=4.63≤5: pass100

The first body 10 exceeds both prior means and our 1.5-times threshold. The second is always 30% of the first, yet 3 exceeds 2.8 and is below 4.6. Its TA-Lib reference includes the first pattern candle, not itself. The default function emits 100 for strict containment or 80 at an accepted body edge; neither code is a probability. The existing saved 120-bar Kraken EUR/USD H1 sample, 21–25 September 2026, contains eight nonzero CDLHARAMI codes, including two of magnitude 80. This is classification of one sample, not a profitability test.

What changes in harami cross?

Harami cross uses a second doji with little or no body. “Almost equal” Open and Close requires a stated tolerance or adaptive definition. This geometry does not prove perfect balance between buyers and sellers or disclose their intentions.

A doji-based variant changes the conditions and may change how many candidates are selected. Its name alone establishes no greater reliability. The spinning top and doji candles guide helps compare definitions. Evaluate unchanged rules, execution, costs and exits on comparable data before comparing outcomes.

How does body containment differ from engulfing?

Harami and the bullish and bearish engulfing pattern reverse the direction of body containment: the second is inside the first in harami, whereas the second contains the first in engulfing. Full-range relationships are a separate question. This geometry does not establish an effectiveness ranking.

A pattern is distinct from entry, exit and execution rules. OHLC does not identify which side “took control”; a small second body can have wide shadows. Compare definitions, retained failures and costs rather than treating body order as proof that a market move has already reversed.

What does the harami look like in an example?

These two EUR/USD models are fictional and independent, with a preceding decline assumed for the bullish version and advance for the bearish version. One pip=0.0001. Two candles alone do not document those preceding trends. Both first bodies have 100 pips and second bodies 30 pips, or 30% of the first.

Fictional EUR/USD: body containment without full-range containment
Model/candleOpenHighLowClose
Bullish 11.09001.09201.07801.0800
Bullish 21.08301.09401.08101.0860
Bearish 11.08001.09201.07801.0900
Bearish 21.08701.08901.07601.0840

The bullish second body 1.0830–1.0860 is strictly within 1.0800–1.0900, yet High 1.0940 exceeds the first High 1.0920 by 20 pips. It passes our body condition and fails an inside-bar range test. The bearish example similarly has the second Low 20 pips below the first. Size and context conditions still need their own checks; body containment alone is not a complete definition for every detector.

As a separate confirmation rule, require a later completed bullish-model close above both highs, hence above 1.0940. Close 1.0930 fails while 1.0942 passes. The first Open 1.0900 is not its High 1.0920, and neither is the maximum of the pair. This is a chosen observational condition, not an entry instruction or universal harami requirement.

Where do you place the entry, stop-loss and target?

A close-based classification is final only after the second candle closes; earlier its body can change or leave the boundary. Any later confirmation becomes available later still. Record those times separately from the time and quote at a possible order or fill. A later close beyond a level does not justify backdating an entry or infer buyer control.

Harami does not itself specify a stop, target or maximum loss. A chosen exit beyond a particular candle extreme is one strategy input, not a mandatory order derived from its name. Determine position size and reward:risk using actual assumed quote sides, fills and costs. Ordinary stops can execute worse, so a planned level supplies no guaranteed loss ceiling. Compare separately specified entry/exit variants on later data.

How do you confirm a harami and avoid the trap?

The Three Inside Up or Down setup adds further candle conditions. State those conditions explicitly rather than treating any third close in the preferred direction as a universally stronger version. Later confirmation changes the decision time and possible execution; it does not by itself establish fewer false signals.

The RSI indicator can be an additional fixed filter. A price-derived oscillator is not automatically independent evidence from a price candle. Keep size, containment, context and confirmation rules separate, preserving rejected cases rather than selecting favourable historical examples.

What to do tomorrow

  1. Record the exact body/range, colour, size, trend and edge-equality criteria. Body containment alone does not reproduce every harami detector.
  2. Choose any later confirmation rule before inspecting outcomes and record when it becomes known. Keep candidate identification separate from execution.
  3. Specify entry, stop, target and position size as separate inputs, including quote sides and costs. An ordinary stop is not a guaranteed loss ceiling.
  4. Compare classic and doji variants using the same unchanged data and trade rules, retaining failures. A few journal examples alone do not establish superiority.
  5. The technical analysis section compares the definitions with engulfing and other patterns. Reversed body containment alone does not prove one strategy stronger.