Function Name: harami

Tags: None

Category: Candlestick, Pattern

A Harami formation indicates loss of momentum and often warns of reversal after a strong trend. Harami means 'pregnant' which is quite descriptive. The second candlestick must be contained within the body of the first, though the shadows may protrude slightly.


1. Market is in uptrend (downtrend).

2. A large green (red) candle occurs,

3. followed by a small candle (of any color).

4. The second candle gaps below (above) the first bar's close and doesn't trade above (below) previous day's close, which means that the high (low) is below (above) previous bar's close.

5. The second bar is completely contained within the body of the first bar, though the shadows may protrude slightly.


If all conditions are met, then Bearish (Bullish) Harami is signalled.



AvgBodyHeightPeriod: Number of previous bars averaged to form a baseline for body size.

LongBodyRelativeThresh: Baseline multiplier that produces the final threshold for minimum size of the first bar.

SmallerBodyRelativeSize: Second candle's body maximum size relative to first candle's body.

RelativeShadowProtrusion: How much can second candle's shadow protrude from the first candle, expressed relative to the first candle's body size.

UseTrendCondition: If false, then first criterion is excluded.

SecondBarOppositeColor: If true, then second bar must be colored opposite from the first bar.





Default Value: 14  |  Minimum: 1  |  Maximum: 999


Type: Numeric



Default Value: 1  |  Minimum: 0  |  Maximum: 10


Type: Numeric



Default Value: 1  |  Minimum: 0  |  Maximum: 1


Type: Numeric



Default Value: 0.10000000000000001  |  Minimum: 0  |  Maximum: 0.5


Type: Numeric



Default Value: -1


Type: Boolean



Default Value: -1


Type: Boolean