Skip to content

Free MT5 indicator

Candlestick Patterns

Marks engulfing, pin bar, shooting star, doji, morning star, evening star and inside bar patterns on closed candles, each with its own toggle.

Price actionv1.0MetaTrader 5 (MQL5) Compiles with 0 errors Non-repainting signals Alerts

What it does

FXP Candlestick Patterns scans closed candles for seven classic patterns and marks them on the chart. Bullish patterns get a blue arrow below the candle, bearish patterns a red arrow above it, and neutral patterns (doji and inside bar) a small gold dot. Short names such as "Engulf", "Pin", "Star", "MStar", "EStar", "Doji" and "Inside" can be printed next to the marks.

Each pattern has its own on/off switch, so you can keep only the ones you actually trade.

How it works

Definitions (body = distance between open and close, range = high minus low):

  • Bullish engulfing: previous candle bearish, current candle bullish, current open at or below previous close, current close at or above previous open, and a larger body. Bearish engulfing is the mirror.
  • Bullish pin bar: lower wick at least N times the body (default 2), lower wick at least 60% of the range and upper wick at most 25% of the range.
  • Shooting star: the same test using the upper wick.
  • Morning star: a large bearish candle (body at least 60% of the 10-bar average range), then a small candle (body at most 30% of the first), then a bullish candle closing above the midpoint of the first body. Evening star is the mirror.
  • Doji: body at most 10% of the range.
  • Inside bar: high below the previous high and low above the previous low.

The prior-move filter requires the close before a bullish reversal pattern to be lower than the close N bars earlier, and the reverse for bearish patterns. The forming candle is never marked, and only new bars are calculated.

How to use it

Copy the .ex5 file into MQL5/Indicators and attach it to a chart.

Patterns matter most at locations that already matter: a bullish pin bar at support, or a bearish engulfing at a prior high after an extended rise. On their own, in the middle of a range, most patterns are noise. Our lesson on candlestick patterns covers how to read them in context.

H1, H4 and D1 candles carry more information than M1 or M5 candles, which are dominated by short-term noise. If you see too many marks, raise the wick ratio, lower the doji percentage, or disable the neutral patterns.

Settings

InputDefaultWhat it changes
Pattern togglesall onEngulfing, pin bar, shooting star, doji, stars, inside bar.
Pin/star: long wick at least N x body2.0Stricter values find cleaner pins.
Doji: body at most % of range10.0Smaller values find fewer, cleaner dojis.
Prior-move filter bars50 disables the trend context check.
History bars to analyse2000Look-back for marks.
Show pattern namestrueText labels next to marks.
Name color / font sizesilver / 7Label styling.
Alert on new patternfalseOne alert per closed candle.
Also send push notificationfalseSends alerts to the mobile app.

Limitations

  • Pattern rules are simplified, mechanical versions of patterns that discretionary traders judge by eye. Some textbook examples will be missed and some marginal ones included.
  • Candle shapes depend on your broker's server time; a daily candle at a GMT+2 broker differs from one at a GMT+0 broker.
  • A pattern is confirmed only when the candle closes, so marks appear one bar after the move started.
  • No pattern predicts direction reliably. Use a stop-loss and size every trade with care. Trading involves substantial risk of loss.

Key inputs

Key inputs of Candlestick Patterns
InputDefaultDescription
Bullish / bearish engulfingtrueToggles engulfing patterns.
Bullish pin bar (hammer shape)trueToggles long-lower-wick pin bars.
Shooting startrueToggles long-upper-wick shooting stars.
Pin/star: long wick at least N x body2.0Minimum wick-to-body ratio for pin bars and shooting stars.
Doji: body at most % of range10.0Maximum body size for a doji.
Prior-move filter bars for reversals (0 = off)5Bullish reversals need a prior decline and bearish reversals a prior rise over this many bars.
Show pattern namestruePrints short pattern names next to the arrows.

Educational tools, not advice. Indicators and Expert Advisors describe price; they do not predict it, and past behaviour does not guarantee future results. Test everything on a demo account first and never risk money you cannot afford to lose. See our disclaimer.

Keep exploring

Related mt5 indicators