Free Forex indicator · MT4 / MT5

Candlestick Pattern Indicator for MT4 & MT5: Free Download

Find selected Japanese candlestick formations on your chart. Compare real EUR/USD examples, understand the detector’s exact rules and download our marked source edition for desktop MT4 or MT5.

ForexBestRobots edition 1.04

Reviewed by ForexBestRobots Editorial Team

Original sourceEarnForex 1.03
PlatformsDesktop MT4 · MT5
LicenseApache 2.0 · Free
On this page

What Candlestick Pattern detects

Candlestick Pattern recognizes 27 named formations from Open, High, Low and Close. It draws an arrow and English label for the selected pattern on a closed candle. It does not measure volume, spread or the probability of a reversal. Names describe this implementation’s rules, not a complete trade entry, stop or exit.

ForexBestRobots edition 1.04 is a marked derivative of EarnForex 1.03. It adds valid-window checks, consistent buffer clearing, isolated object ownership and silent initial/resumed scans. It corrects the Marubozu Down wick comparisons. Dependencies are embedded in one source file; unchanged original modules, copyright and Apache 2.0 remain in each package.

Rules, pattern IDs and priority

Let R=High−Low and B=abs(Close−Open). Neutral Doji requires B<0.05×R and excludes Dragonfly/Gravestone shapes. Equality at 5% does not qualify; a completely flat zero-range candle is not a Doji here. Marubozu needs B>0.95×R and each relevant wick below 2% of range. The corrected Down rule mirrors Up.

Several definitions differ from common textbook shortcuts. Engulfing requires the current body to exceed the previous full range and its Close to pass the previous High/Low. Tweezer tolerance is ±5% of quoted price, not five points. Harami uses 5 candles including three earlier body midpoints; Three-Line Strike uses 4, but its final candle only has to engulf the immediately preceding body. Most rules have no separate trend filter.

Only one enabled matching rule wins per candle, in source-code priority, not numeric ID order. Group filters are applied after selection; filtering out the winner does not fall through to a lower-priority match. Hanging Man and Inverted Hammer, both Spinning Tops and all Doji variants have direction 0 here. A downward arrow on an uncertain label is placement, not a sell instruction.

Buffer 0 contains 1 for bullish, -1 for bearish or 0 for uncertain/no result. Buffer 1 contains the selected ID 1–27; 0 means no result. Read both together: a Doji is 0/1, while no pattern is 0/0. Open shift 0, invalid windows and positions outside the scan limit are zero. The table lists each rule’s minimum source history.

R = High - Low
B = abs(Close - Open)
DojiBody = (B < 0.05 * R)
Buffer0 ∈ {-1, 0, 1}
Buffer1 ∈ {0, 1, ..., 27}
shift0 = 0; source_shift >= 1
IDPatternDirectionRequired candles
1DojiUncertain · 01
2Dragonfly DojiUncertain · 01
3Gravestone DojiUncertain · 01
4Bullish Spinning TopUncertain · 01
5Bearish Spinning TopUncertain · 01
6Marubozu UpBullish · 11
7Marubozu DownBearish · -11
8HammerBullish · 11
9Hanging ManUncertain · 01
10Inverted HammerUncertain · 01
11Shooting StarBearish · -11
12Bullish EngulfingBullish · 12
13Bearish EngulfingBearish · -12
14Tweezer TopBearish · -12
15Tweezer BottomBullish · 12
16Three White SoldiersBullish · 13
17Three Black CrowsBearish · -13
18Three Inside UpBullish · 13
19Three Inside DownBearish · -13
20Morning StarBullish · 13
21Evening StarBearish · -13
22Bullish HaramiBullish · 15
23Bearish HaramiBearish · -15
24Bullish Three-Line StrikeBullish · 14
25Bearish Three-Line StrikeBearish · -14
26Three Outside UpBullish · 13
27Three Outside DownBearish · -13

Real EUR/USD examples

The figures reconstruct archived Yahoo Finance EUR/USD H1 OHLC, normalized to five decimals before detection. CSVs retain the raw values and four earlier context candles. Letters highlight selected examples only; labels and colors are illustrative. These are not MetaTrader screenshots, live alert logs or performance backtests. Times are UTC; the program uses broker time.

On 3 June 2025, A at 01:00 is Marubozu Down (7), B at 09:00 Doji (1), C at 20:00 Gravestone Doji (3) and D at 22:00 Hammer (8). Their next available openings are 02:00, 10:00, 21:00 and 23:00. On 4 June, Three Outside Up (26) at 07:00 is observable at 08:00; Bullish Engulfing (12) at 12:00 is observable at 13:00, while rule 6 also matches.

The priority comparison uses the same 4 June 06:00 candle, observable at 07:00. Default selection is Bearish Three-Line Strike (25), direction -1, although the final candle is bullish. Setting DetectBearishThreeLineStrike=false exposes Bullish Engulfing (12), direction 1. Setting only DetectBearish=false instead yields no result: category filtering does not choose the next rule. This is a software-selection example, not a performance comparison.

3 June 2025, EUR/USD H1. A: Marubozu Down (7); B: Doji (1); C: Gravestone Doji (3); D: Hammer (8). Source times and next openings are shown; selected annotations only.
3 June 2025, EUR/USD H1. A: Marubozu Down (7); B: Doji (1); C: Gravestone Doji (3); D: Hammer (8). Source times and next openings are shown; selected annotations only.

Open vector chart · OHLC and pattern data (CSV)

4 June 2025. A: Three Outside Up (26), 07:00 → 08:00 UTC. B: Bullish Engulfing (12), 12:00 → 13:00; rule 6 also matches but loses priority.
4 June 2025. A: Three Outside Up (26), 07:00 → 08:00 UTC. B: Bullish Engulfing (12), 12:00 → 13:00; rule 6 also matches but loses priority.

Open vector chart · OHLC and pattern data (CSV)

Same 06:00 candle on 4 June, observed at 07:00 UTC. Default ID 25/-1 versus ID 12/1 with the individual strike rule disabled. Disabling the bearish group alone gives no result.
Same 06:00 candle on 4 June, observed at 07:00 UTC. Default ID 25/-1 versus ID 12/1 with the individual strike rule disabled. Disabling the bearish group alone gives no result.

Open vector chart · OHLC and pattern data (CSV)

Chart timeframe and confirmation

The indicator uses the current chart symbol and timeframe; there is no MTF projection. H1 examples describe hourly source candles only. Changing broker, timeframe or precision can change the formations. Some rules require up to 5 completed source candles, including context before the visible or scanned section.

A notification is evaluated when a new opening timestamp is available, using the last closed candle, shift 1. After missing quotes or a weekend, this may be later than its nominal close. Corrections to history can change an earlier label. Closed-candle processing does not guarantee identical results across feeds or immutable history.

Settings and defaults

There are 44 functional inputs and 6 Comment_* separators. MaxCandle defaults to 500 completed source positions; 0 scans all loaded closed candles. Valid values are 0–1000000. Older context can still be read for the earliest scanned positions. All 27 individual switches and all three group switches are initially true.

IndicatorName is also the per-chart object prefix: use 1–20 unique ASCII letters, digits, underscores or hyphens. A duplicate FBR chart/prefix is rejected without deleting the first copy. FontSize accepts 6–48, Font 1–80 characters, Xoff/Yoff 0–5000 and ChartCorner one of the four corners. Original colors are green/red/black; change the uncertain-label color for a dark chart. Large scans can create many objects.

InputDefaultPractical meaning
Comment_1"===================="Main-section separator only.
IndicatorName"PTRNDET"Unique chart prefix; 1–20 ASCII letters/digits/_/-.
Comment_2"===================="Detection-section separator only.
MaxCandle500Completed positions to scan; 500 initially, 0 all; maximum 1000000.
DetectBullishtrueAllow the selected bullish category; no priority fallback.
DetectBearishtrueAllow the selected bearish category; no priority fallback.
DetectUncertaintrueAllow the selected uncertain category.
Comment_2a"===================="Individual-pattern separator only.
DetectDojiNeutraltrueEnable the Doji rule.
DetectDojiDragonflytrueEnable the Dragonfly Doji rule.
DetectDojiGravestonetrueEnable the Gravestone Doji rule.
DetectSpinningTopBulltrueEnable the Bullish Spinning Top rule.
DetectSpinningTopBeartrueEnable the Bearish Spinning Top rule.
DetectMarubozuUptrueEnable the Marubozu Up rule.
DetectMarubozuDowntrueEnable the Marubozu Down rule.
DetectHammertrueEnable the Hammer rule.
DetectHangingMantrueEnable the Hanging Man rule.
DetectInvertedHammertrueEnable the Inverted Hammer rule.
DetectShootingStartrueEnable the Shooting Star rule.
DetectEngulfingBulltrueEnable the Bullish Engulfing rule.
DetectEngulfingBeartrueEnable the Bearish Engulfing rule.
DetectTweezerToptrueEnable the Tweezer Top rule.
DetectTweezerBottomtrueEnable the Tweezer Bottom rule.
DetectThreeWhiteSoldiertrueEnable the Three White Soldiers rule.
DetectThreeBlackCrowstrueEnable the Three Black Crows rule.
DetectThreeInsideUptrueEnable the Three Inside Up rule.
DetectThreeInsideDowntrueEnable the Three Inside Down rule.
DetectMorningStartrueEnable the Morning Star rule.
DetectEveningStartrueEnable the Evening Star rule.
DetectBullishHaramitrueEnable the Bullish Harami rule.
DetectBearishHaramitrueEnable the Bearish Harami rule.
DetectBullishThreeLineStriketrueEnable the Bullish Three-Line Strike rule.
DetectBearishThreeLineStriketrueEnable the Bearish Three-Line Strike rule.
DetectThreeOutsideUptrueEnable the Three Outside Up rule.
DetectThreeOutsideDowntrueEnable the Three Outside Down rule.
Comment_2b"===================="Display-section separator only.
Font"Verdana"Label font; 1–80 characters.
FontSize8Label font size; 6–48, initially 8.
FontColorBullishclrGreenBullish text/arrow color.
FontColorBearishclrRedBearish text/arrow color.
FontColorUncertainclrBlackUncertain text/arrow color; initially black.
Comment_3"===================="Notification-section separator only.
EnableNotifyfalseMaster notification switch; off by default.
SendAlerttruePopup; active only with EnableNotify.
SendAppfalsePush; configure the terminal first.
SendEmailfalseEmail; configure the terminal first.
Comment_4"===================="Panel-section separator only.
ChartCornerCORNER_LEFT_UPPEROne of the four chart corners.
Xoff20Horizontal panel spacing; 0–5000, initially 20.
Yoff20Vertical panel spacing; 0–5000, initially 20.

Pause, clear and notifications

EnableNotify=false is the master default despite SendAlert=true. Popup, push and email are available; there is no separate WAV-file channel. Sound depends on the terminal’s alert settings. Push/email need a configured, online desktop terminal. Messages contain symbol, timeframe, pattern and source/observation times, without account-name or login fields. No orders are executed.

Initial attachment, explicit history reset and resuming detection rebuild silently. Thereafter only the newest closed pattern is processed once per new opening timestamp, even when the history length stays capped. There is no queue of old patterns or every-tick retry after a failed notification attempt.

Pause stops scanning and new notifications, keeps existing markers and clears both buffers. Clear removes this instance’s markers, clears buffers and leaves detection paused. Resume rebuilds on the next calculation without sending old alerts. Chart-scale changes reposition visible labels; a new scan replaces the instance’s prior markers.

Install and compile the source

  1. Extract the ZIP for MT4 or MT5.
  2. In desktop MetaTrader choose File → Open Data Folder, then MQL4 or MQL5.
  3. Copy the ZIP’s Indicators folder there; keep upstream separately as the unchanged reference.
  4. Open Candlestick_Pattern_ForexBestRobots.mq4 or .mq5 in the matching MetaEditor, press F7 and inspect diagnostics.
  5. Refresh Navigator → Indicators and attach the compiled program to a demo chart with a unique IndicatorName.
  6. Start with EnableNotify off. Check IDs, direction, scan limit, priority and panel behavior before configuring and demo-testing notification channels.

The download contains MQ4/MQ5 source, without ready EX4/EX5 binaries. Custom desktop indicators cannot be installed directly into MetaTrader mobile. Copy only our marked Indicators folder for normal installation; upstream contains original reference files, not required dependencies. CSVs explain the figures and are not indicators.

Download Candlestick Pattern free

Download the platform ZIP directly from this site. It includes marked self-contained source, unchanged original main/include modules, Apache 2.0, change notes, a textual patch, checksums and installation notes in all 12 site languages. No registration, DLL or external include is required by our marked source.

Compile with F7 in the matching desktop MetaEditor, inspect errors and warnings, then demo-test. Numerical and modeled-API checks outside MetaTrader do not verify native compilation, terminal rendering, chart events, broker history or actual notification delivery.

Free source ZIP · ForexBestRobots edition 1.04 · Compile in MetaEditor

Detection limits and changing history

A pattern ID is a classification, not a win rate or prediction. Several formulas are simplified, and a named bullish/bearish category does not necessarily match the final candle’s color. Prices, session boundaries and rounding near strict thresholds can change the winner.

The chart contains selected objects, while buffers describe the currently processed history. Paused buffers are zero even if old labels remain visible. A group filter and an individual pattern switch can produce different outcomes because priority is evaluated first.

No spread, commission, slippage, position size or exit model is included. The examples establish no trading performance. This edition retains the documented upstream definitions except the marked Marubozu Down wick correction; compare code conventions before comparing other detectors.

Frequently asked questions

Does it recognize all candlestick patterns?

No. It implements 27 named rules with specific definitions. Other detectors may use different thresholds or context.

Why is only one pattern shown?

The first enabled match in code priority wins. Numeric ID order is different. Group filtering after selection does not fall through.

Does direction 0 mean no pattern?

Not necessarily. Check buffer 1 too: 0/1 is Doji, while 0/0 means no result.

Are notifications confirmed on a closed candle?

Yes. The latest closed shift 1 is processed at the next available opening. Initial and resumed scans are silent.

What do Pause and Clear do?

Pause keeps markers but clears buffers and stops scanning/notifications. Clear also removes the markers and leaves detection paused.

Can I run multiple copies?

Yes, with different IndicatorName prefixes on the same chart. Duplicate FBR chart/prefix ownership is rejected.

Are these compiled files tested inside MetaTrader?

No. They are MQ4/MQ5 sources for desktop MetaEditor. External checks do not verify native compilation or runtime.

Sources and verification scope

The review follows the pinned EarnForex source and our marked changes. Original copyright is preserved. Reconstructions are our calculations on archived real quotes. Inclusion and modification do not imply endorsement by EarnForex.