Join waitlist
Strategies / Pattern / Pin Bar and Engulfing Setup

Pin Bar and Engulfing Setup

Looks for bullish or bearish pin bars and engulfing candles near recent lows or highs, in the direction of a 9-period average, with above-average volume. Each trade has a stop-loss and a profit target set from the 7-period ATR.

PatternLong & shortSwingBrent Crude4 hours
n/aProfit factor
3,332Net profit EUR
41.29%Win rate
155Trades
-3,277Max drawdown
21.50Avg trade

Best run of 3. Brent Crude, 4 hours, spread 3, from run sweeps:2026-10-07-BRENT-4h-opt.tsv:5.

Entry rules, long

  1. The close is above the 9-period simple moving average.
  2. The low is at most 1.002 times the lowest low of the last 6 bars.
  3. The close is above the previous bar's high.
  4. Volume is at least 1.2 times its 5-bar average.
  5. No entry signal has fired in the last 3 bars.

Entry rules, short

  1. The close is below the 9-period simple moving average.
  2. The high is at least 0.998 times the highest high of the last 6 bars.
  3. The close is below the previous bar's low.
  4. Volume is at least 1.2 times its 5-bar average.
  5. No entry signal has fired in the last 3 bars.

Exit rules

  1. The profit target sits 1.5 times the stop distance from entry.

Test conditions

PeriodUp to 2026-10-07
InstrumentBrent Crude, 4 hours
Spread3 points
Starting capital1,000,000
CostsSpread only. Commissions and overnight financing are not included.
BarsUp to 200,000 bars, fewer where the instrument has less history
Last tested2026-10-07

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
Brent CrudeBest run4 hoursn/a 15541.293,332 EUR-3,277
USD/JPYDailyn/a 10543.814,350 USD-4,340
GoldDailyn/a 6147.54740 EUR-392

Charts

Results by run

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// Pin Bar and Engulfing Setup
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Pattern
// Direction: Long & short
// Timeframe tested: 4 hours
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE lasttrade = -1000

smafast = Average[9](close)

47 more lines: the entry and exit rules.

Setup

How to load it

  1. Copy the code with the copy button on the code block.
  2. In ProRealTime, open a chart of the instrument and timeframe you want to test, then open ProOrder > New trading system and choose "Create with programming".
  3. Paste the code, give the system a name and save it.
  4. Click "Backtest", set your own spread and position size, and run it before you consider trading it live.

Indicators used

SMAATRVolume
Read this firstKnown weaknesses2 points
  • No profit factor is available, because only sweep results exist for this strategy.
  • The maximum drawdown of 3,277 EUR is large next to the net profit of 3,332 EUR.

Questions

About this strategy

Can I run Pin Bar and Engulfing Setup in ProOrder?

Yes. The code is ProBuilder and runs as an automated ProOrder system. Backtest it on your own account with your own spread and position size before trading it live.

Which markets was it tested on?

It was tested on 3 market and timeframe combinations. The best run by trade count was Brent Crude, 4 hours, with 155 trades.

How large was the drawdown?

The best run had a maximum drawdown of 3,277 EUR at the tested position size, against a net result of 3,332 EUR.

Does it trade long, short or both?

It trades both long and short.

Related

Strategies like this one

Trend Surfer

Uses the same indicator.

1.04 PF · 10,813 trades

Hull Trend With ADX Filter

Best run on the same market, Brent Crude.

1.27 PF · 1,400 trades

Breakout Reversal

Also a pattern strategy.

n/a PF · 459 trades

Want strategies that are already part of a live portfolio? Join the ProRealAlgos waitlist.

The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.

Past backtest results do not guarantee future results. This is not financial advice. Curated and maintained by ProRealAlgos. ProRealTime™ is a trademark of ProRealTime SAS. prorealalgos.comStatsDocs