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.
Best run of 3. Brent Crude, 4 hours, spread 3, from run sweeps:2026-10-07-BRENT-4h-opt.tsv:5.
| Period | Up to 2026-10-07 |
| Instrument | Brent Crude, 4 hours |
| Spread | 3 points |
| Starting capital | 1,000,000 |
| Costs | Spread only. Commissions and overnight financing are not included. |
| Bars | Up to 200,000 bars, fewer where the instrument has less history |
| Last tested | 2026-10-07 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| Brent CrudeBest run | 4 hours | n/a | 155 | 41.29 | 3,332 EUR | -3,277 |
| USD/JPY | Daily | n/a | 105 | 43.81 | 4,350 USD | -4,340 |
| Gold | Daily | n/a | 61 | 47.54 | 740 EUR | -392 |
Charts
The code
// ============================================================== // 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
Questions
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.
It was tested on 3 market and timeframe combinations. The best run by trade count was Brent Crude, 4 hours, with 155 trades.
The best run had a maximum drawdown of 3,277 EUR at the tested position size, against a net result of 3,332 EUR.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.