Candlestick Pattern Detector
Detects Japanese candlestick patterns and labels them on the chart, with per-pattern switches and alerts
Main chartHas alerts
An indicator that marks candles matching a pin bar pattern with a smiley face above or below, with alerts
Open source, Apache License 2.0, by EarnForex.com. See licences
First release on this site.
A green smiley face below a candle is a bullish pin bar and a red smiley face above a candle is a bearish pin bar. The candle with the smiley has a small body at one end, its other wick pokes past the low (bullish) or high (bearish) of the previous candle (the Left Eye), and its body stays inside the previous candle's high-low range. The smiley appears only after the bar has closed.
The defaults require a body of no more than 33% of the candle length, sitting in the 40% at one end, a wick that protrudes past the previous candle by at least half of the candle length, and a Left Eye of the opposite direction (for example a bearish candle before a bullish pin bar). CountBars sets how many bars are calculated (0 = all) and DisplayDistance sets how far the smileys sit from the candle.
UseAlerts turns on a popup alert with a sound. UseEmailAlerts needs SMTP and UseNotificationAlerts needs push notifications set up in the terminal first. Alerts are sent only for a pin bar on the bar that has just closed. The Custom* parameters apply only when UseCustomSettings is on. Note from the code: the CustomNoseBodyInsideLeftEyeBody option is declared but never applied, so it has no effect on detection.
| Name | Default | Description |
|---|---|---|
| CountBars | 0 | Number of bars to calculate. 0 = all. |
| DisplayDistance | 5 | Distance of the smiley from the candle. A higher value places it farther away. |
| UseAlerts | true | true = show a popup alert with a sound when a pin bar is found. |
| UseEmailAlerts | false | true = send an email when a pin bar is found (set up SMTP in the terminal). |
| UseNotificationAlerts | false | true = send a push notification to the mobile app when a pin bar is found (set up push in the terminal). |
| UseCustomSettings | false | true = use the Custom* criteria below instead of the built-in values. |
| CustomMaxNoseBodySize | 0.33 | Maximum body-to-candle-length ratio of the Nose bar (the pin bar itself). |
| CustomNoseBodyPosition | 0.4 | Body position in the Nose bar, e.g. 0.4 = within the top or bottom 40% of the bar. |
| CustomLeftEyeOppositeDirection | true | true = the Left Eye must be the opposite colour to the pattern (bearish for a bullish pin bar and vice versa). |
| CustomNoseSameDirection | false | true = the Nose must be the same colour as the pattern (bullish for a bullish pin bar). |
| CustomNoseBodyInsideLeftEyeBody | false | true = the Nose body must sit inside the Left Eye body (in the code this option is not applied). |
| CustomLeftEyeMinBodySize | 0.1 | Minimum body-to-candle-length ratio of the Left Eye. |
| CustomNoseProtruding | 0.5 | Minimum protrusion of the Nose past the Left Eye, relative to the Nose length. |
| CustomNoseBodyToLeftEyeBody | 1 | Maximum Nose body size relative to the Left Eye body. |
| CustomNoseLengthToLeftEyeLength | 0 | Minimum Nose length relative to the Left Eye length. |
| CustomLeftEyeDepth | 0.1 | Minimum depth of the Left Eye relative to its length (the difference from the back of the Nose). |
| CustomMinimumNoseLength | 1 | Minimum Nose candle length in points. |
Defaults are the values shipped with the EA, not a recommendation. Results depend on the market and on each account. Past results do not guarantee future results. Trading carries a high risk of loss.
Pinbar Detector looks for the pin bar candlestick pattern: a candle whose wick extends past the previous candle with a small body at one end. It compares each closed candle with the one before it (called the Left Eye). A bullish pin bar is shown as a green smiley face below the candle, and a bearish pin bar as a red smiley face above it.
The defaults use the indicator's built-in criteria. Turn on UseCustomSettings to set your own, such as body-to-candle ratio, body position, how far the wick protrudes past the previous candle, and size relative to the Left Eye.
When a pin bar is found on the latest closed bar, it sends a popup alert with a sound, and can also send an email or a mobile push. It opens no trades.
Banners from the Exness partner programme

FXIDTH is an independent IB partner of Exness. This channel is not owned or operated by Exness.*Spreads may fluctuate and widen due to factors including market volatility, news events, market open/close, and others.*Processing times may vary depending on the chosen payment method.
Detects Japanese candlestick patterns and labels them on the chart, with per-pattern switches and alerts
Main chartHas alerts
Semi-automatic EA that places pending orders from the lines and channels you draw on the chart, for breakout patterns
Price-action EA for XAUUSD on M5 that builds zones from engulfing candles and enters when price retests the zone
XAUUSD · M5