Skip to content
FXNook HubBeta

Alex / Candlestick Pattern Indicator (Engulfing, Pin Bar, Inside Bar) for MT5

MetaTrader 5IndicatorMITCompiled · build 6333
AlexFirst version.build 6333v1.08 hours ago1 version
  • FXN_CandlePatterns.mq5First version.9 KB
  • FXN_CandlePatterns.ex5Compiled by the Lab with MetaEditor build 633323 KB
README

Overview

Marks bullish and bearish engulfing candles, pin bars (hammer and shooting star) and inside bars on closed candles, with clear rules and optional alerts.

Engulfing candles, pin bars and inside bars are the core of many price action methods. This indicator checks every closed candle with fixed, written rules and marks the patterns with arrows and short labels, so you do not miss them and can review them consistently.

How it works

The average range is the mean of high - low over the previous Average range bars candles. For engulfing and pin bars the candle range must be at least Minimum size x that average, which ignores tiny candles.

  • Bullish engulfing: previous candle bearish, current candle bullish, current open at or below the previous close, current close at or above the previous open, and a bigger body.
  • Bearish engulfing: the mirror image.
  • Hammer (bullish pin bar): lower wick at least Pin wick x the body and at least Pin wick % of the range; upper wick at most Pin nose % of the range.
  • Shooting star (bearish pin bar): the mirror image with the upper wick.
  • Inside bar: high and low both inside the previous candle's range, with a smaller range.

Bullish patterns get an up arrow below the candle, bearish patterns a down arrow above it, inside bars a small diamond. Labels show the pattern names, for example "Engulfing + Hammer" or "IB".

Inputs

InputDefaultWhat it does
Engulfing / Pin bars / Inside barstrueTurn each pattern on or off
Pin wick2.0Long wick at least this many bodies
Pin wick %60Long wick at least this % of the candle
Pin nose %25Other wick at most this % of the candle
Minimum size0.5Candle at least this x the average range (0 = off)
Average range bars14Bars for the average range
History bars3000Bars to scan (0 = all)
Show labelstruePattern names next to the arrows
Bullish / bearish / inside colourSeaGreen / Crimson / GoldenrodColours
Label font size7Text size
AlertsfalseOne alert when a closed candle forms a pattern

How to use it

  1. In MetaTrader open File > Open Data Folder.
  2. MT4: copy FXN_CandlePatterns.mq4 into MQL4/Indicators. MT5: copy FXN_CandlePatterns.mq5 into MQL5/Indicators.
  3. Right-click Indicators in the Navigator and choose Refresh (or restart the terminal). The file compiles on first use; you can also open it in MetaEditor and press Compile.
  4. Drag the indicator onto a chart and set the inputs.

The defaults suit H1 to D1. On lower timeframes raise Minimum size to 0.8-1.0 to filter noise. Patterns carry more weight at levels that matter: support and resistance, a fair value gap, or in the direction of the higher-timeframe trend. Turn off the patterns you do not use to keep the chart clean.

Good to know

  • Closed candles only. The forming candle is never marked, so arrows do not appear and disappear.
  • The rules do not check the trend before the pattern; a hammer here is a shape, wherever it forms.
  • The three arrow buffers can be read with iCustom; empty candles hold EMPTY_VALUE.
  • It marks patterns only and does not trade.

Trading carries risk. Test on a demo account first; past results do not predict future results.

At a glance

What it is
A free Indicator for MetaTrader 5, written in MQL5.
What it does
Marks bullish and bearish engulfing candles, pin bars (hammer and shooting star) and inside bars on closed candles, with clear rules and optional alerts.
Shared by
Alex
Licence
MIT
Version
1.0 (1 Dec 2026)
Settings
15 inputs
Lab check
Compiled with MetaEditor build 6333 for MT5 on 1 Dec 2026: 0 errors, 0 warnings.
Price
Free to download

Settings read from the code

InputTypeDefaultNote
InpEngulfingbooltrueBullish / bearish engulfing
InpPinBarbooltruePin bars (hammer / shooting star)
InpInsideBarbooltrueInside bars
InpPinWickdouble2.0Pin bar: long wick at least this many bodies
InpPinWickPctdouble60.0Pin bar: long wick at least this % of the candle
InpPinNosePctdouble25.0Pin bar: other wick at most this % of the candle
InpMinRangedouble0.5Engulfing / pin: candle at least this x average range (0 = off)
InpAvgBarsint14Bars used for the average range
InpMaxBarsint3000History bars to scan (0 = all bars)
InpShowLabelsbooltrueWrite the pattern name next to the arrow
InpBullColorcolorclrMediumSeaGreenBullish colour
InpBearColorcolorclrCrimsonBearish colour
InpInsideColorcolorclrGoldenrodInside bar colour
InpFontSizeint7Label font size
InpAlertsboolfalseAlert once when a closed candle forms a pattern

How to use it

  1. Download the compiled file (or the source and compile it in MetaEditor).
  2. Put it in MetaTrader: File → Open Data Folder → MQL5 → Indicators, then refresh the Navigator.
  3. Test it on a demo account before any real money.
  4. Want changes? Open a copy in your Lab and ask for them in plain words.