Join today
Strategies / Pattern / Harami Pullback

Harami Pullback

An inside bar that closes against the trend is treated as a pullback. If the close is above the 50-period SMA and the inside bar is a down bar, the system buys the next open, and the short side mirrors this. Every trade closes one bar after entry.

PatternLong & shortSwingEUR/USDDaily
n/aProfit factor
61,578Net profit USD
53.01%Win rate
998Trades
-20,302Max drawdown
61.70Avg trade

Best run of 1. EUR/USD, Daily, spread 1, from run sweeps:2026-09-24-EURUSD-D-opt.tsv:13.

Entry rules, long

  1. Inside bar: lower high and higher low than the previous bar
  2. Members only
  3. Close is above the 50-period SMA
  4. Buy at the next bar's open

Entry rules, short

  1. Inside bar: lower high and higher low than the previous bar
  2. Members only
  3. Close is below the 50-period SMA
  4. Sell short at the next bar's open

Exit rules

  1. Members only
  2. No stop loss or target

Test conditions

PeriodUp to 2026-09-24
InstrumentEUR/USD, Daily
Spread1 points
Contracts1
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-09-24

Parameters

positionSize
Contracts per trade
1
trendPeriod
SMA trend filter length
50
maxBarsInTrade
Close the trade this many bars after entry
1

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
EUR/USDBest runDailyn/a 99853.0161,578 USD-20,302

Charts

Results by run

Net profit against max drawdown

Net profitMax drawdown
0-25K-13K50K100KEUR/USD · Daily

The code

ProBuilder, rewritten to house standard

Every file in the library uses the same header, the same section order and the same variable names. The numbers above were produced by the original version before the rewrite, and the rewrite has not yet been compiled in ProRealTime.

// ============================================================
// Harami Pullback
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Pattern
// Direction: Long & short
// Timeframe tested: Daily
// ============================================================

// --- Settings ---
DEFPARAM CumulateOrders = false

// --- Parameters ---
positionSize = 1       // contracts per trade
trendPeriod = 50       // SMA trend filter
maxBarsInTrade = 1     // close the trade this many bars after entry

// --- Indicators ---
trendMA = Average[trendPeriod](close)
insideBar = high < high[1] AND low > low[1]
barsInTrade = BarIndex - TradeIndex

22 more lines: the entry and exit rules.

Read this first

Known weaknesses

  • Only tested on one market, EUR/USD Daily.
  • There is no stop loss or target, so a large gap against the position is taken in full.
  • Profit factor was not recorded because the result comes from sweep data. The win rate was 53.01%.
  • Max drawdown was USD 20,302 against USD 61,578 net profit over 998 trades.

Indicators used

SMA

How to load it

  1. Copy the code with the copy button above 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.

Questions

About this strategy

Can the Harami Pullback be automated in ProOrder?

Yes, it enters at the next bar open and exits by bar count, both simple in ProOrder. The code is a rewrite without a compile check, and the stats are from the older version.

What did the EUR/USD test show?

On EUR/USD Daily it made USD 61,578 over 998 trades, averaging USD 61.70 per trade.

How much risk does 1 contract carry?

At 1 contract the max drawdown was USD 20,302. With no stop, that is the main number to size your account by.

Why hold for just one bar?

The idea is a quick snap back after a pause inside the prior bar. Holding longer turns it into a trend trade, which the setup is not built for.

Related

Strategies like this one

Bollinger Squeeze

Uses the same indicator.

14.30 PF · 86 trades

Slow MACD Slope

Best run on the same market, EUR/USD.

6.80 PF · 7,305 trades

Winter Only

Also a pattern strategy.

14.53 PF · 49 trades

Short-hold pattern trades are one building block. Join the ProRealAlgos waitlist to see the full toolbox.

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