Candle patterns

Classic candlestick shapes such as engulfing, hammer, doji, inside bar and stars.

Candle shapes only (context is the strategy's job), each true on the candle that completes it. body = |close − open|, range = high − low; a doji has body ≤ doji_ratio × range. A zero-range candle has no ratio shape. Engulfing (V1): opposite colours, neither a doji, the body contains the previous body and is larger. Harami: the body inside the previous opposite, non-doji body. Hammer: lower wick ≥ hammer_wick_body × body, upper wick ≤ hammer_max_opposite × range. Pin bar (V1): body ≥ pin_min_body × range, the wick > pin_wick_body × body and > pin_wick_ratio × range. Inside bar (V1): high < previous high and low > previous low. Stars: a big candle (body ≥ star_big × range), a small one (body ≤ star_small × range) at or beyond the first close, then a big opposite candle closing past the first body's middle.

Candle patterns is a structure detector: it marks price structure on the chart and counts against the plan's detector limit.

Settings

SettingDefaultRangeWhat it does
doji_ratio0.10 to 0.5Doji: largest body ÷ range.
pin_min_body0.050 to 0.5Pin bar: smallest body ÷ range.
pin_wick_ratio0.60.3 to 1Pin bar: the wick is more than this share of the range.
pin_wick_body20.5 to 20Pin bar: the wick is more than this many bodies.
hammer_wick_body20.5 to 20Hammer: the long wick is at least this many bodies.
hammer_max_opposite0.10 to 0.5Hammer: the other wick is at most this share of the range.
star_big0.50.1 to 1Stars: smallest body ÷ range of the first and last candle.
star_small0.30 to 0.9Stars: largest body ÷ range of the middle candle.

What it gives

OutputWhat it is
Bullish engulfingTrue on a bullish engulfing candle.
Bearish engulfingTrue on a bearish engulfing candle.
Bullish haramiTrue on a bullish harami.
Bearish haramiTrue on a bearish harami.
HammerTrue on a hammer (long lower wick).
Shooting starTrue on a shooting star (long upper wick).
DojiTrue on a doji (tiny body).
Inside barTrue when the range is inside the previous candle's.
Outside barTrue when the range covers the previous candle's on both sides.
Morning starTrue on the third candle of a morning star.
Evening starTrue on the third candle of an evening star.
Bullish pin barTrue on a bullish pin bar (long lower wick).
Bearish pin barTrue on a bearish pin bar (long upper wick).

What it reads

It reads the whole candle (open, high, low, close and volume).

Warm-up

With its default settings, Candle patterns needs 3 closed candles before its first value. A backtest loads them before its start date, so the first trade can already use it.

Test it

Copy this sentence into the Algonney chat to backtest it:

Backtest a strategy on BTC that uses Candle patterns with its default settings