Pin Bar V1 Indicator for MT4 and MT5

Written by Dominic Walsh · Published · Last updated

A pin bar is a candle that rejects a price with a long wick. The pin bar v1 indicator applies three shape rules: a wick at least twice the body, a body no more than 35% of the range, and an opposite wick no more than 35% of the range. An optional trend check skips pins that trade with the recent move.

This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from EURUSD H1.

Platforms MT4 (.ex4) + MT5 (.ex5)
Chart window Main price chart
Plots 2: Pin Bar Buy, Pin Bar Sell
Alerts popup, push notification, email, sound
Inputs 13

Plot by plot

Two marks on price, nothing else.

`Pin Bar Buy` prints lime with arrow 233.

`Pin Bar Sell` prints red with arrow 234.

Marks sit `ArrowOffsetPts` `25` points off the bar.

A status line shows the settings.

No lines are drawn.

  • Pin Bar Buy: arrow, lime, width 2, arrow code 233
  • Pin Bar Sell: arrow, red, width 2, arrow code 234
pin bar v1 indicator: Pin bar marks on EURUSD H1.
Pin bar marks on EURUSD H1.

The computation

Shape

`WickBodyRatio` `2.0` asks for a lower wick at least twice the body for a bullish pin. `BodyRangeMax` `0.35` caps the body.

Opposite wick

`OppWickFraction` `0.35` caps the upper wick of a bullish pin, and the close must sit in the upper half of the range.

Trend check

`UseTrendFilter` ships `false`. Switched on, a bullish pin above its `TrendLookback` `20` bar average is skipped.

What you are looking at

A lime mark is a rejection of lower prices.

A red mark is a rejection of higher prices.

Longer wicks mean stronger rejection.

Pins at levels matter more than pins mid-range.

`CooldownBars` `3` spaces same-side marks.

Marks appear on closed candles.

Alert channels in this build: popup, push notification, email and sound, one message per closed bar.

Each pin bar sends one message once its candle closes. `EnableAlerts` controls it; the popup, mobile route and sound start on, and email does not.

Every Pin Bar V1 Indicator input

Core settings

Setting What it does Default
WickBodyRatio Long wick must be N x body. Wick length versus body, `2.0`. 2.0
OppWickFraction Opposing wick max as fraction of range. Largest opposite wick, `0.35`. 0.35
BodyRangeMax Body must be <= N of range. Largest body share, `0.35`. 0.35
TrendLookback Bars for short trend filter. Bars in the trend average, `20`. 20
UseTrendFilter Filter bullish pins in uptrend etc. Skip pins with the trend, `false`. off
CooldownBars Min bars between same-side signals. Bars between same-side marks, `3`. 3

Display settings

Setting What it does Default
ArrowOffsetPts Arrow distance from high/low in points. Mark gap in points, `25`. 25

Alert settings

Setting What it does Default
EnableAlerts Master alert switch, `true`. on
EnablePopup (see inputs panel) on
EnablePushNotify Mobile route, ships on, `true`. on
EnableEmail (see inputs panel) off
EnableSound Sound, ships on, `true`. on
SoundFile (see inputs panel) alert.wav
pin bar v1 indicator: Inputs panel, shape rules above the trend check.
Inputs panel, shape rules above the trend check.

Which markets and timeframes suit it

Pin bars appear on every chart. EURUSD H1 is the reference chart, with several a day. On M15 they are frequent and weak. On D1 they are the classic price action reversal signal.

When it misleads

Pin bars in the middle of a range mean little.

No level context is checked.

The trend check ships off.

Mobile and sound routes ship on.

Copy the compiled Pin Bar V1 Indicator file into your MQL4/Indicators folder, and the MT5 build into MQL5/Indicators, then restart the terminal and drag it onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.

Background reading on the method behind the Pin Bar V1 Indicator: Hammer at Investopedia, Hammer (candlestick pattern) on Wikipedia.

Download the Pin Bar V1 Indicator for MT4 and MT5

The zip holds the compiled Pin Bar V1 Indicator build for MT4 and MT5, plus a short README. Compiled files only, no source. Enter your email below and the download link arrives in your inbox.

Download this indicator free

Enter your email and the file is yours. You also get the full MT4 and MT5 library.

  • 1,380+ indicators
  • MT4 and MT5 files
  • No spam, unsubscribe any time

FAQ

What shape does WickBodyRatio 2.0 require?

A rejection wick at least twice as long as the candle’s body. A long wick with a large body is a strong candle, not a pin, so it gets no mark.

What does OppWickFraction 0.35 rule out?

Candles with long wicks on both ends. The opposite wick must stay under 35% of the range, so the candle clearly rejected only one side.

What does UseTrendFilter do when on?

It skips bullish pins that close above the 20-bar average and bearish ones that close below it. Only pins that fade the recent move stay marked, which cuts the count sharply.

Why must a Pin Bar Buy close in the upper half?

A bullish rejection should finish near its high. A close in the lower half means sellers still held control despite the long wick, so the build does not count it as a buy.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Pin Bar V1 Indicator as one input. Always backtest before trading live.

Category: this is part of our Signal and Forecast collection. Browse more Signal and Forecast for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.

External references

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

How we build, test and correct every tool: Editorial & Testing Policy. Trading carries risk; see the disclaimer.

Leave a Comment