- Strategy
- Buys after a bullish pin bar that makes the lowest low of the last 20 bars and sells after a bearish pin bar that makes the highest high of the last 20 bars. The stop goes beyond the wick.
- Risk model
- 1% of balance per trade (configurable), stop-loss beyond the pin-bar wick on every order, one position at a time
What it does
A pin bar has a long wick and a small body, showing that price pushed one way during the bar and was rejected. Pin Bar Reversal EA only trades pin bars that form at a swing extreme, where a rejection is more meaningful than in the middle of a range.
How it works
For the last closed bar, with range = high − low and body = |close − open|:
- Bullish pin: lower wick (lower of open/close − low) is at least 60% of the range, the body is at most 33% of the range, and the bar's low is the lowest low of the last 20 bars.
- Bearish pin: upper wick (high − higher of open/close) is at least 60% of the range, the body is at most 33%, and the bar's high is the highest high of the last 20 bars.
- Size filter: the bar's range must be at least 0.8 × ATR(14).
- Entry: at market on the open of the next bar.
- Stop-loss: low − 0.1 × ATR for buys, high + 0.1 × ATR for sells. Trades whose stop would exceed 3 × ATR are skipped.
- Take-profit: 2 × the stop distance.
The candlestick patterns lesson covers pin bars and related shapes, and support and resistance explains why location matters.
How to use it
Higher timeframes give more reliable pin bars, because more trading activity stands behind each wick. H4 and D1 are a good starting point. Lowering the wick ratio to 0.5 increases trade count at the cost of weaker patterns. Some traders also restrict trading to their main session through the trading-hours inputs.
Settings
| Input | Default | What it changes |
|---|---|---|
| Swing lookback | 20 | Location requirement |
| Min wick ratio | 0.60 | Strictness of the rejection |
| Max body ratio | 0.33 | Strictness of the small body |
| Min range (x ATR) | 0.8 | Ignores small bars |
| Stop buffer (x ATR) | 0.1 | Room beyond the wick |
| Max stop (x ATR) | 3.0 | Skips very wide setups |
| Reward:risk target | 2.0 | Take-profit, 0 disables it |
| Risk per trade / Fixed lots | 1.0% / 0 | Position sizing |
| Max spread / Trading hours | 30 / 7–20 | Filters |
| Break-even / Trailing | on / off | Stop management |
Limitations
A pin bar at a 20-bar extreme is still only one bar of evidence, and strong trends often print pin bars that fail. Long wicks mean wide stops and smaller position sizes. Pattern definitions differ between traders, so the EA may skip bars you would call pin bars, or take some you would not.
Before you run it live
Test it in the Strategy Tester on several symbols and timeframes and review the trades visually to check the pattern matches your idea of a pin bar. Then run it on a demo account with a small risk per trade. Past behavior does not guarantee future results.

