Markets › Metals · XAUUSD spot (broker data), 1-hour

Pin Bar Trading Strategy Backtest: Gold (XAUUSD), 1-Hour Bars, 2004 to 2026

A long tail, a small body at the other end, a nose that pokes out of the recent bars: the pin bar is taught as price rejecting a level. We found 2,008 of them in 22 years of 1-hour gold and traded them the way they are usually taught, with costs and a control.

XAUUSD (broker data) · 1-hour bars · pin bars: entry on the break of the bar or at its middle, stop beyond the nose, target 2R · Protocol v1.0 plus the 8 Oct 2026 rules

Buried · Costs

Before costs, almost exactly break-even. After costs, buried.

BornRules, versions, costs and gates frozen 24 Nov 2026 (pb_spec.md), before any pin bar was computed
Died24 Nov 2026

Variants tried: 4 · Passed every gate: 0 · Best: 2 of 6 gates · Holdout opened: yes (already used)

Short answer: not in our test. On gold 1-hour bars from 2004 to 2026, 2,008 textbook pin bars traded on the break of the bar with a 2R target made +0.011 R a trade before costs and -0.063 R after, no better than the same trades placed on random days. Four versions, with a trend filter, a half-bar entry and long only, were all buried.Compare all 21 gold strategies we tested →

00The verdict in three lines

  • We tested the pin bar on gold 1-hour bars from July 2004 to October 2026: a bar whose tail is at least two thirds of its range, at least as large as the average bar, with the nose sticking out of the previous 10 bars. A buy stop one tick above a bullish pin bar (a sell stop below a bearish one) for the next hour, or a limit order at the middle of the bar, the stop one tick beyond the nose, the target twice the risk. $0.30 an ounce a round trip.
  • None of the four versions passed. Before costs they made between +0.010 R and +0.084 R a trade; after costs all four lost, from -0.003 R (with the trend filter) to -0.081 R (the half-bar entry).
  • The main version did exactly what random days did: the same trades moved to other days at the same time of day averaged -0.064 R, against -0.063 R for the real ones (the 51st percentile; 95 needed). Only the half-bar entry reached the 95th percentile, and it lost the most after costs.

01What a pin bar is, and where the rules come from

A pin bar is one candle with a long tail on one side and a small body at the other end. A bullish pin bar has its tail below: during the hour the price fell well below where it opened, then came back up and closed near the top. The usual reading is that sellers pushed through a level and buyers threw them back. The name is commonly traced to Martin Pring's “Pinocchio bar”, the bar whose long nose lies about where the price is going.

There is no single official definition, but the pages that teach it agree on the main points. The body sits in the top or bottom third of the bar's range, so the tail is about two thirds of the bar or more (this is how DailyForex defined it in 2012, and most broker and education pages say the same). The tail should stick out of the surrounding bars, at a level, and a large pin bar counts for more than a small one. The common entry is a break of the end opposite the nose (above the high of a bullish pin bar); a second, popular entry is a limit order at about half of the bar, the “50% retrace”. The stop goes just beyond the nose, the target is usually two times the risk, and pin bars in the direction of the trend are preferred. None of the pages we read gives a test result that can be checked.

What we had tested before (disclosed). Our closest test is the engulfing candle on gold, on the same 1-hour file: all four versions made a little before costs, beat their control and lost after costs, because the stop at the candle was only about $3.07 away and the $0.30 cost took about 0.14 R a trade. That is why our pin bar must be at least as large as the average bar. The other candle test on the site is the inside bar on EUR/USD daily bars. Section 12 compares the pin bar and the engulfing candle directly.

02The rules, mechanically

  • The bars: 1-hour bars on the New York clock, closing on the hour, built from the 1-minute bars that exist. Every price has two decimals, so every rule below is checked in whole cents and no rounding can decide a pin bar.
  • The shape: a bullish pin bar has a lower tail (from the low to the lower of the open and close) of at least two thirds of the bar's range; a bearish one, an upper tail of at least two thirds. The colour of the bar does not matter.
  • The size: the bar's range is at least the 14-bar average true range (Wilder's) of the bars before it.
  • The nose sticks out: the low of a bullish pin bar is strictly below the lows of the previous 10 bars; the high of a bearish one strictly above their highs. This is our mechanical version of “at a level”: the bar made a new 10-hour extreme and was pushed back.
  • The entry, break versions: a buy stop one tick ($0.01) above the pin bar's high (a sell stop one tick below a bearish pin bar's low), working only during the next hour. It fills at the level, or at the minute's open if the price jumps past it. Not filled in that hour: cancelled.
  • The entry, half version: a limit order at the middle of the pin bar, working for the next three hours. If the price opens beyond the stop before it fills, there is no trade.
  • The trade: the stop one tick beyond the nose; R is the distance from the fill to the stop; the target is 2R from the fill. In the minute of the fill only the stop counts (we cannot know the order of prices inside a minute, so we assume the worse one); after that, if the stop and the target are touched in the same minute, the stop is taken. No time limit; positions are held over weekends. One position at a time: a pin bar that closes while a trade is open or an order is working is ignored.
  • Four versions: PB-BRK (break entry, both directions), PB-TREND (the same, but bullish pin bars only when the bar closes above the 200-bar EMA and bearish ones only below it), PB-HALF (the half-bar entry, both directions) and PB-BRK-L (break entry, bullish pin bars only, since gold rose from $384 to $4,110 an ounce over this file). Candle patterns already had seven versions on the site, so the development t-statistic needed is 2.5.

03How many pin bars gold printed

StepBullishBearishShare of the 129,357 bars
Tail at least two thirds of the bar8,0397,30111.9%
… and a range at least the 14-bar ATR2,2441,7783.1%
… and the nose beyond the last 10 bars: pin bars1,1368721.6%

About one 1-hour bar in eight has the shape, but most are small: the size rule keeps 26% of them, and the nose rule half of those. What is left is 2,008 pin bars in 22 years, 76 to 117 in each full year, with a median range of $4.82 an ounce, 1.42 times the average bar before it. Only 38 of them (1.9%) were also engulfing candles of our engulfing test in the same direction, so the two tests trade almost entirely different bars.

Not every pin bar became a trade. The break order filled in 67.9% of cases: in about a third, the next hour never went past the far end of the pin bar. The half-bar order filled in 72.0% of cases within three hours. Some pin bars closed while a trade was still open and were skipped, as the one-position rule says.

04Data and costs

Gold (XAUUSD), the 1-minute bid history of an IC Markets MetaTrader 4 demo server, from 11 June 2004 to 7 October 2026, the same file and cut as every gold test on the site; pin bars from the 501st 1-hour bar (mid-July 2004). The prices are not republished. Clock: the file's time labels are an hour early in most weeks of 2004 to 2010; we used the clock of our October audit, which moves those weeks. A check before the run confirmed that the US 08:30 data releases land in the right minute in every year and that every price has two decimals (dtop_datacheck.txt, pb_datacheck.txt). Costs: $0.30 per ounce per round trip, as in every gold test on the site, with no slippage beyond fills at a gapped open, which is optimistic; $0.45 and $0.75 and two financing scenarios are in section 13. Periods: development 2004 to 2012, validation 2013 to 2019, holdout 2020 to 2026, already used by our earlier gold tests.

Engine check: a self-test with 32 hand-worked cases, run on both the engine and an independent re-implementation (a one-pass program written from the specification, by the same author, an AI, Claude, not by an independent person). On the real data both found the same 2,008 pin bars and every trade of the four versions; cutting the data at four points gave the same pin bars and trades, so no rule looks ahead (pb_selftest_result.txt). It passed on its first run.

05Results

Net R after costs, without financing. The win rate is the share of trades that ended positive, with its 95% range.

VariantRuleTradesGross per tradeNet after costsNet per tradeWinners (95% range)Profit factorVerdict
PB-BRKStop order beyond the bar (next hour only); bullish and bearish1,252+0.011 R-79 R-0.063 R34.0% (31% to 37%)0.91Buried
PB-TRENDThe same, only with the 200-bar EMA526+0.069 R-1 R-0.003 R35.7% (32% to 40%)1.00Buried
PB-HALFLimit order at the middle of the bar (next three hours); bullish and bearish1,415+0.084 R-115 R-0.081 R36.6% (34% to 39%)0.89Buried
PB-BRK-LStop order beyond the bar; bullish pin bars only754+0.010 R-46 R-0.061 R33.7% (30% to 37%)0.92Buried
-100 R-50 R0 R200620102014201820222026validationholdout*PB-BRKPB-TRENDPB-HALFPB-BRK-L

Cumulative net R by month. * Holdout already used before this test.

By period

VariantDevelopment 2004 to 2012 (trades)Validation 2013 to 2019 (trades)Holdout* 2020 to Oct 2026 (trades)Development tValidation PF
PB-BRK-17.3 R (460)-58.0 R (404)-4.2 R (388)-0.540.81
PB-TREND+11.7 R (203)-17.7 R (149)+4.6 R (174)0.540.84
PB-HALF-29.3 R (550)-26.8 R (446)-58.9 R (419)-0.800.92
PB-BRK-L-0.02 R (277)-43.9 R (230)-1.8 R (247)0.000.75

No version was positive in all three periods. PB-TREND made +11.7 R in development and +4.6 R in the holdout, but lost 17.7 R in validation; over 22 years it ended at -1.39 R, flat. The break version without a filter lost in all three periods. Three of the four lost most in 2013 to 2019, the years when gold fell from its 2011 high and then moved sideways; PB-HALF lost most in the holdout.

Year by year, next to gold

YearGold, first open → last closePin barsPB-BRK (trades)PB-TREND (trades)PB-HALF (trades)PB-BRK-L (trades)
2004 (from July)$384 → $437 (+14%)50+10.8 R (26)+3.2 R (10)-0.9 R (33)+5.0 R (11)
2005$437 → $515 (+18%)93-21.8 R (51)+0.1 R (17)-19.2 R (74)-14.0 R (31)
2006$517 → $636 (+23%)83+1.9 R (51)+3.0 R (23)-12.5 R (58)+2.2 R (31)
2007$638 → $832 (+30%)93-11.2 R (55)-12.5 R (27)+1.8 R (63)-6.3 R (32)
2008$841 → $867 (+3%)85+17.6 R (56)+4.7 R (26)+8.1 R (60)+14.3 R (34)
2009$874 → $1,098 (+26%)86-7.6 R (52)+11.5 R (20)-4.5 R (61)-1.0 R (29)
2010$1,095 → $1,408 (+29%)80-9.3 R (53)+3.6 R (30)-21.7 R (58)+0.9 R (30)
2011$1,416 → $1,564 (+10%)82+5.1 R (55)+1.4 R (27)+12.2 R (60)+10.0 R (39)
2012$1,567 → $1,675 (+7%)105-2.7 R (61)-3.4 R (23)+7.4 R (83)-11.1 R (40)
2013$1,673 → $1,208 (-28%)98-23.5 R (60)+4.0 R (25)-8.0 R (77)-26.6 R (40)
2014$1,225 → $1,187 (-3%)110+17.3 R (67)+17.8 R (25)+5.6 R (65)-7.1 R (37)
2015$1,187 → $1,061 (-11%)99-20.8 R (58)-15.8 R (23)-1.0 R (72)-7.3 R (29)
2016$1,065 → $1,151 (+8%)85-11.3 R (54)-13.9 R (23)-5.5 R (57)+3.8 R (33)
2017$1,152 → $1,302 (+13%)92-0.2 R (54)+7.2 R (18)-3.0 R (67)+1.6 R (31)
2018$1,310 → $1,279 (-2%)83-10.0 R (58)-12.7 R (17)-18.4 R (55)-8.6 R (35)
2019$1,282 → $1,520 (+19%)81-9.5 R (53)-4.4 R (18)+3.4 R (53)+0.3 R (25)
2020$1,520 → $1,893 (+25%)117+7.2 R (71)-0.5 R (35)+0.2 R (83)+2.0 R (47)
2021$1,909 → $1,828 (-4%)91-16.9 R (53)-13.2 R (21)-5.5 R (73)-15.8 R (32)
2022$1,831 → $1,824 (0%)85+11.3 R (52)+4.7 R (24)+0.5 R (57)-3.4 R (29)
2023$1,827 → $2,063 (+13%)82+0.9 R (56)-3.3 R (23)-13.6 R (61)+6.3 R (34)
2024$2,063 → $2,625 (+27%)89+6.5 R (60)+16.6 R (33)-4.7 R (57)+18.4 R (37)
2025$2,624 → $4,316 (+64%)76-9.3 R (56)+1.5 R (22)-11.1 R (45)-1.9 R (40)
2026 (to 7 Oct)$4,319 → $4,110 (-5%)63-3.8 R (40)-1.2 R (16)-24.6 R (43)-7.3 R (28)

PB-BRK ended 9 of the 23 calendar years positive, PB-TREND 13. With 20 to 70 trades a year at a 2R target, one year says little either way.

06Why a third of winners is not enough

With the stop at -1R and the target at +2R, a trade that is a pure coin toss between the two levels reaches the target first about one time in three. That is the break-even before costs: 33.3% winners. The cost is paid on every trade, so after costs a version needs about (1 + cost in R) / 3 winners to break even.

VariantWinnersBreak-even before costsCost per tradeBreak-even after costs (about)Median risk (R) per ounceMedian hours held
PB-BRK34.0%33.3%0.074 R35.8%$4.786.0
PB-TREND35.7%33.3%0.072 R35.7%$4.986.4
PB-HALF36.6%33.3%0.165 R38.8%$2.331.2
PB-BRK-L33.7%33.3%0.070 R35.7%$5.166.4

Every version won a little more than a third of the time. The break versions without a filter won 34.0% and 33.7%, barely above the coin toss and below what they needed after costs. The trend filter and the half-bar entry won 35.7% and 36.6%, two to three points more: PB-TREND won about exactly what it needed (hence its -0.003 R a trade), and PB-HALF, with its much larger cost per trade, fell short. The trades were short: half of them ended within about 6 hours in the break versions and 1.2 hours in the half version.

By size. Split into thirds by the risk in dollars, the smallest pin bars lost the most after costs, as in the engulfing test, but the largest ones made nothing either:

VariantThirds split atSmall riskMediumLarge
PB-BRK$3.60 / $6.33-0.148 R (gross -0.019 R)-0.039 R (gross +0.025 R)-0.003 R (gross +0.027 R)
PB-TREND$3.85 / $6.52-0.062 R (gross +0.062 R)+0.106 R (gross +0.168 R)-0.051 R (gross -0.021 R)
PB-HALF$1.75 / $3.06-0.136 R (gross +0.166 R)-0.025 R (gross +0.107 R)-0.083 R (gross -0.021 R)
PB-BRK-L$3.87 / $6.74-0.183 R (gross -0.059 R)+0.030 R (gross +0.089 R)-0.029 R (gross -0.002 R)

07Bullish and bearish, with and without the trend

VariantSideTradesGross per tradeNet per tradeNet after costs
PB-BRKbullish (buys)727+0.002 R-0.068 R-49.5 R
PB-BRKbearish (sells)525+0.024 R-0.057 R-29.9 R
PB-TRENDbullish (buys)337+0.054 R-0.017 R-5.7 R
PB-TRENDbearish (sells)189+0.096 R+0.023 R+4.3 R
PB-HALFbullish (buys)800+0.115 R-0.044 R-35.1 R
PB-HALFbearish (sells)615+0.044 R-0.130 R-79.8 R
PB-BRK-Lbullish (buys)754+0.010 R-0.061 R-45.7 R

Gold rose about 11-fold over these years, yet the bullish pin bars traded on the break made almost nothing before costs (+0.002 R a trade in PB-BRK, +0.010 R in PB-BRK-L): a trade that lasts a few hours collects almost none of a rise that took 22 years. The bearish ones did slightly better before costs (+0.024 R). The trend filter lifted both sides before costs (+0.054 R for the buys and +0.096 R for the sells), which is why PB-TREND ended closest to zero; with 526 trades and a development t of 0.54, that difference is well within luck.

08The half-bar entry: a better price, a smaller risk, a larger cost

The limit order at the middle of the pin bar buys a bullish pin bar about halfway down its tail instead of above its high. That does two things. The trades are better before costs (+0.084 R a trade against +0.011 R for the break entry), and the risk is about half as large (a median $2.33 an ounce against $4.78). But the cost is the same $0.30 an ounce, so in R it doubled: 0.165 R a trade, about twice the gross. PB-HALF ended at -0.081 R a trade, the worst of the four, and it lost 58.9 R in the holdout. It is also the only version whose timing reached the bar of our control (next section).

09Is it the pattern or chance?

The moved-entry control: every real fill moved by one random offset of whole days, at least 5% of the series, to the same time of day on another day, same direction, with the stop and the target at the same distances measured in units of the 14-bar ATR at the new time (so a $2 pin bar of 2005 moved to 2025 keeps its size relative to the market); same costs, same one-position rule; 500 runs with fixed seeds. The bar is the 95th percentile of the average net R per trade.

VariantTradesReal average per tradeControl trades (mean)Control medianControl 5th to 95thRuns beatenPercentile (95 needed)
PB-BRK1,252-0.063 R966-0.064 R-0.141 R to +0.021 R255 of 50051.0
PB-TREND526-0.003 R421-0.056 R-0.174 R to +0.062 R389 of 50077.8
PB-HALF1,415-0.081 R1,127-0.147 R-0.221 R to -0.082 R475 of 50095.0
PB-BRK-L754-0.061 R589-0.048 R-0.152 R to +0.055 R212 of 50042.4

PB-BRK and PB-BRK-L sat in the middle of their controls: the pin bar picked no better moments than random hours did. PB-TREND did better than most runs but not enough. PB-HALF beat 475 of the 500 runs, exactly the 95% the gate asks for, so its timing passes the gate at the line; its random copies lost even more (a median of -0.147 R) because they paid the same large cost share. A pin bar entered at its middle may be slightly better than chance, but the edge, if real, is far smaller than the cost of trading it with a stop that tight.

10The gates

VariantTrades1. PF ≥ 1.2 in validation2. ≥ 50 trades in each period3. t ≥ 2.5 on development4. Above the 95th percentile of the moved-entry control5. Positive without the 10 best trades6. Holdout net positive (already used)
PB-BRK1,252fail (0.81)passfail (-0.54)fail (51.0)failfail
PB-TREND526fail (0.84)passfail (0.54)fail (77.8)failpass
PB-HALF1,415fail (0.92)passfail (-0.80)pass (95.0)failfail
PB-BRK-L754fail (0.75)passfail (0.00)fail (42.4)failfail

Every version had enough trades in every period (gate 2). None came near the development t of 2.5 or the validation profit factor of 1.2. PB-TREND also passed the holdout gate (+4.6 R, already used), PB-HALF the control gate.

11Verdict by variant

VariantCauseGates failedVerdict
PB-BRKCosts1, 3, 4, 5, 6Buried
PB-TRENDCosts1, 3, 4, 5Buried
PB-HALFCosts1, 3, 5, 6Buried
PB-BRK-LCosts1, 3, 4, 5, 6Buried

The cause follows the protocol's definition: Costs means positive before costs and negative after. That is true of all four, but for PB-BRK and PB-BRK-L the gross was +0.011 R and +0.010 R a trade, which is zero in practice; for them the cost is not what stood between the pattern and a profit. No verdict changed under our data-gap rule (section 13). Buried means that a convincing edge was not shown here; it does not prove that none exists.

TWhat this shows, and what to take into your own tests

What the results show

  • Textbook pin bars on gold 1-hour bars (a tail of two thirds of the bar, a bar at least as large as the average, a nose poking out of the last 10 bars) were close to worthless before costs: traded on the break of the bar with a 2R target, they made +0.011 R a trade over 1,252 trades and won 34.0% of the time, where one in three is break-even.
  • The same trades placed on random days at the same time did as well (the 51st percentile of the control). Only the half-bar entry beat 475 of 500 control runs, and its small stops made costs 0.17 R a trade, twice its gross.
  • Trading only with the 200-bar EMA came closest: -0.003 R a trade after costs, positive in 13 of 23 years, but with a development t of 0.54 (2.5 needed) and a validation profit factor of 0.84.

What remains unknown

  • How it does on new data. The holdout here (2020 to 2026) was already used by our earlier gold tests, so it is not a clean out-of-sample test.
  • Pin bars picked by eye at levels a trader would mark (support, resistance, round numbers), other tail ratios, other timeframes (the daily chart, where pin bars are most often taught) and other markets.
  • Slippage. Every stop order filled at its level unless the minute opened beyond it; around news, real stop orders on gold fill worse.

Why it was buried

The pattern did not pick better moments than chance in three of the four versions, and none of them made enough before costs to pay for them. With a 2R target a third of the trades must win just to break even; these won 33.7% to 36.6%, while the cost of $0.30 an ounce raised the break-even to about 35.7% to 38.8%.

What you can apply to your own tests

  • Before you trust a pattern, compare its win rate with the one its own target needs: at 2R, one in three is break-even, and costs raise it.
  • A tighter stop improves the reward ratio on paper and raises the cost in R. Here the half-bar entry halved the risk and doubled the cost share.
  • Test a pattern against the same trades on random days. A rule that only matches chance is a description of the chart, not an edge.

A note on the numbers: drawdown figures are measured on closed trades unless a table says it includes open losses. Open losses inside a trade are not counted in a closed-trade drawdown, so real account risk is higher, especially for systems with no stop. Backtests are not live trading.

12Pin bar against engulfing candle, same gold file

Both are candle patterns read as a reversal, both were tested on the same 1-hour gold file with the same cost, and both are buried. The pin bar test required a larger bar and a stop order beyond it; the engulfing test entered at the next open with the stop at the engulfing candle.

VersionTradesMedian risk per ounceGross per tradeCost per tradeNet per tradeWinnersControl percentileGates
PB-BRK1,252$4.78+0.011 R0.074 R-0.063 R34.0%51.01 of 6
PB-TREND526$4.98+0.069 R0.072 R-0.003 R35.7%77.82 of 6
PB-HALF1,415$2.33+0.084 R0.165 R-0.081 R36.6%95.02 of 6
PB-BRK-L754$5.16+0.010 R0.070 R-0.061 R33.7%42.41 of 6
EG-1R12,186$2.98+0.012 R0.146 R-0.134 R49.9%99.62 of 6
EG-2R8,825$3.07+0.028 R0.142 R-0.113 R33.9%98.42 of 6
EG-2R-REV6,276$2.96+0.031 R0.145 R-0.114 R34.1%96.42 of 6
EG-2R-2006,254$3.00+0.056 R0.143 R-0.088 R35.2%99.62 of 6

The size rule did what it was meant to do: the pin bar's break versions paid about 0.07 R a trade in costs, half the engulfing candle's 0.14 to 0.15 R. But the gross stayed about as small (+0.010 R to +0.084 R a trade, against +0.012 R to +0.056 R), and the pin bar's timing beat the control in only one version, where all four engulfing versions did (percentiles 96.4 to 99.6). The two controls are not exactly alike: the engulfing test kept the stop and target distances in dollars when it moved a trade, this one scales them by the ATR at the new time. Neither pattern paid for its costs.

13Costs, financing and the data-gap check

Costs and financing. The verdicts use $0.30 an ounce and no financing. Scenario A charges 3% a year of the price for every day held, longs and shorts alike; scenario B applies the swap IC Markets charges today (long −57.03 and short +39.767 points per lot per night, Wednesday counting three) to every night, which is not the historical cost. Both financing scenarios and both higher costs make every version worse; today's swap hurts the long-only version most.

Variant$0.30 (verdict)$0.45$0.75Scenario A: 3% a yearScenario B: today's swap
PB-BRK-0.063 R (PF 0.91)-0.101 R (PF 0.87)-0.175 R (PF 0.78)-97.5 R-108.5 R
PB-TREND-0.003 R (PF 1.00)-0.038 R (PF 0.95)-0.110 R (PF 0.86)-9.1 R-19.6 R
PB-HALF-0.081 R (PF 0.89)-0.164 R (PF 0.80)-0.329 R (PF 0.64)-127.0 R-131.0 R
PB-BRK-L-0.061 R (PF 0.92)-0.096 R (PF 0.87)-0.166 R (PF 0.79)-56.5 R-112.2 R

Data gaps (rule 3). Our rule 3 removes the trades that were open across a suspect or unclear gap in the data and recomputes every gate; if the verdict changes, the result is Inconclusive.

VariantTradesRemovedNet per tradeGates passedVerdict
PB-BRK1,252172-0.063 R → -0.100 R1 → 1 of 6Buried → Buried
PB-TREND52682-0.003 R → -0.039 R2 → 1 of 6Buried → Buried
PB-HALF1,41585-0.081 R → -0.111 R2 → 1 of 6Buried → Buried
PB-BRK-L75496-0.061 R → -0.104 R1 → 1 of 6Buried → Buried

Without those trades every version did worse, and no verdict changed.

FAQCommon questions

What is a pin bar?

A single candle with a long tail (the nose) on one side and a small body at the other end of its range: the price pushed through a level during the bar and was pushed back before the close. In our test the tail had to be at least two thirds of the bar, the bar at least as large as the 14-bar average true range, and the nose beyond the highs or lows of the previous 10 bars.

Does the pin bar strategy work?

Not well enough to pass our test on gold. Across four versions and 3,947 trades from 2004 to 2026, the pin bars made between +0.010 R and +0.084 R a trade before costs and lost after costs (-0.003 R to -0.081 R a trade). The main version did exactly what the same trades did on random days.

What is the win rate of the pin bar?

In our test 33.7% to 36.6% of the trades reached their 2R target before their stop. With the target twice as far as the stop, one winner in three is break-even before costs, and the cost of $0.30 an ounce raised that to about 36% to 39%.

Is the 50% retrace entry better than the break of the pin bar?

Before costs, yes: a limit order at the middle of the pin bar made +0.084 R a trade against +0.011 R for the break entry, and it was the only version that beat 95% of its random-day control (475 of 500 runs). But its stop was about half as far, so the same $0.30 cost took 0.17 R a trade, and it lost the most after costs (-0.081 R a trade).

Should you trade pin bars only with the trend?

In our test the trend filter (bullish pin bars only above the 200-bar EMA, bearish ones only below it) came closest to break-even, at -0.003 R a trade after costs over 526 trades. It was not reliable: positive in the development years, negative in validation, with a development t of 0.54 where 2.5 is needed.

Pin bar or engulfing candle: which is better?

On the same gold file, neither paid for its costs. The engulfing candle beat its control in all four versions but its stop at the candle was small, so costs took about 0.14 R a trade; the pin bar, required to be larger, paid about half that in its break versions, but made about as little before costs and beat its control in only one version. Only 1.9% of the pin bars were also engulfing candles.

How was the pin bar strategy tested?

On 1-minute gold prices from a broker from 2004 to 2026, 1-hour bars on a corrected clock, $0.30 an ounce of costs a trade, and rules written and dated before the data was run, costs included on every trade, results split into development, validation and holdout periods, a random-entry control as the benchmark, and every variant reported. Read the protocol.

14Check our arithmetic

Frozen specificationDated before the run, with the run log.
pb_spec.md
CodeThe engine (its readings of the rules at the top), the independent re-implementation, the self-test, the run, and the data checks run before it.
pb_lib.js · pb_ref.js · pb_selftest.js · pb_run.js · pb_datacheck.js · dtop_datacheck.js
Shared code and data files it usesThe gold loader and the audit clock, bars, the trade booking with costs and swap, statistics and control helpers, the record of suspect gaps.
control_audit_lib.js · em_lib.js · fx_data.js · gh_lib.js · gold_audit_clock.js · gx_lib.js · hourly_lib.js · hs_lib.js · ma_lib.js · rb_lib.js · rs_lib.js · rsi2_protocol.js · clock_audit_fix.json · data_holes_xau.json · dtop_holes_audit.json · gc_rolls.json
ResultsData checks, the self-test result, the console output of the run and all numbers as files.
dtop_datacheck.txt · pb_datacheck.txt · pb_selftest_result.txt · pb_results.txt · pb_summary.json · pb_gates.json
Trade logs (CSV)Every trade of the four versions: the pin bar's close, entry and exit (New York time), the order level, prices, stop, target, risk, the pin bar's range and the ATR before it, gapped fills, the exit reason, gross and net R, the worst open loss, both financing scenarios and whether it crossed a suspect gap.
PB-BRK · PB-TREND · PB-HALF · PB-BRK-L
Data recordWhere the gold file comes from and its checks. The prices themselves are not republished.
data_manifest.md

To rerun it: set MT4_HISTORY to the folder that holds the XAUUSD1.hst history file, then run node dtop_datacheck.js --out=./pb_out, node pb_datacheck.js, node pb_selftest.js and node pb_run.js (node pb_run.js --reproduce checks a second run against the saved files).

Code provenance: code written for this test from the published descriptions of the pin bar and the rules fixed in the specification. No third-party source code is used or published.

15Data notes

Source. A broker's demo history, not an exchange record; bid prices; costs constant across years. Clock. Corrected with our October 2026 audit, as described in section 04; the pin bar rules do not depend on the time of day, but the 1-hour bar boundaries and the control's “same time of day” do. Gaps. See section 13.

16Corrections

None since publication.

+More tests and guides