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.
Best run of 1. EUR/USD, Daily, spread 1, from run sweeps:2026-09-24-EURUSD-D-opt.tsv:13.
| Period | Up to 2026-09-24 |
| Instrument | EUR/USD, Daily |
| Spread | 1 points |
| Contracts | 1 |
| 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-09-24 |
| positionSize Contracts per trade | 1 |
| trendPeriod SMA trend filter length | 50 |
| maxBarsInTrade Close the trade this many bars after entry | 1 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| EUR/USDBest run | Daily | n/a | 998 | 53.01 | 61,578 USD | -20,302 |
Charts
The code
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
Questions
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.
On EUR/USD Daily it made USD 61,578 over 998 trades, averaging USD 61.70 per trade.
At 1 contract the max drawdown was USD 20,302. With no stop, that is the main number to size your account by.
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
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.