Markets › Metals · XAUUSD spot (broker data)

Head and Shoulders Pattern Backtest: Gold (XAUUSD), 15-Minute Bars, 2004 to 2026

The best-known chart pattern, defined by a published algorithm instead of by eye, on 22 years of 15-minute gold: two pattern sizes, tops and inverse patterns, costs and a control.

Gold (XAUUSD) · 15-minute bars · head and shoulders (Osler and Chang's rules) at two sizes · Protocol v1.0 plus the 8 Oct 2026 rules

Buried · No proven edge

Five of six gates. Its first nine years could not prove it.

BornFrozen 16 Oct 2026 (hs_spec.md), before any pattern was computed
Died16 Oct 2026

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

Short answer: not proven on gold in our test, but close. With a published mechanical definition (Osler and Chang, 1995) on 22 years of 15-minute gold, the smaller patterns, sold below the neckline of a top and bought above the neckline of an inverse pattern with the stop beyond the right shoulder and the target at the pattern's height, made +0.16 R a trade after costs over 279 trades and beat every run of a random-timing control, but failed one of our six gates: the evidence from 2004 to 2012 alone was too weak. Larger patterns did no better than chance.How much costs took here, compared across all 54 of our tests →Compare all 14 gold strategies we tested →

00The verdict in three lines

  • We tested the head-and-shoulders pattern on 15-minute gold from July 2004 to October 2026, with a published mechanical definition (Osler and Chang, Federal Reserve Bank of New York, 1995) at two sizes: a sell on a 15-minute close below the neckline of a top, a buy on a close above the neckline of an inverse pattern, the stop beyond the right shoulder and the target the pattern's height. $0.30 an ounce a round trip.
  • The smaller patterns made money in every period and beat chance, and still failed one gate. Tops and inverse patterns together: +46 R over 279 trades (+0.16 R a trade after costs), above all 500 runs of a control that placed the same trades at other times, five of our six gates. The one it failed: the evidence from 2004 to 2012 alone was too weak (development t 1.26; 2.0 needed).
  • The larger patterns did not work: -6 R over 135 trades with tops and inverse patterns, +2 R with inverse patterns only, no better than random entries.

01What we tested

A head and shoulders top is three peaks with the middle one, the head, highest; the line through the two troughs between them is the neckline, and the pattern is complete when the price closes below it. The inverse pattern is the mirror image at a low. Drawn by eye, everyone sees a different one, so we used a definition that was published and tested before: the computer algorithm of Osler and Chang (Federal Reserve Bank of New York Staff Report 4, 1995, on daily exchange rates), as described by Boainain and Pereira (Revista Brasileira de Finanças, 2009), applied to 15-minute bars.

  • Peaks and troughs come from a zigzag of the 15-minute closes: a peak is confirmed when the close falls k times the recent volatility below the highest close since the last trough (the volatility is the standard deviation of the 15-minute log changes over the previous 2,000 bars, about a month), a trough the same way upward. A peak is only known once it is confirmed, so the rules never look ahead.
  • Two sizes: k = 3 (Osler and Chang used ten cut-offs from 1.5 to 6; 3 sits in the middle of them) finds patterns whose shoulders are a median 19 hours of trading apart; k = 6 (the top of their range), 54 hours apart.
  • A valid top (seven pivots in a row): a rise before it (the left shoulder above the peak before it, and the trough after the left shoulder above the trough before it); the head higher than both shoulders; neither side of the pattern more than 2.5 times as long as the other; and Osler and Chang's height rule (each shoulder above the midpoint between the other shoulder and its trough, each trough below it). The inverse pattern is the mirror image.
  • The break: the first 15-minute close beyond the neckline after the right shoulder is confirmed, and before the next pivot; it must come within as many bars after the right shoulder as there are between the shoulders, or the pattern is dropped.
  • The trade: entry at the next minute's open; the target is the pattern's height (head to neckline) measured from the neckline at the break, as the textbook “measure rule” says; the stop is beyond the right shoulder (its highest high for a top, its lowest low for an inverse pattern). If the stop and the target are touched in the same minute, the stop is taken. One position at a time.
  • Results in R, where R is the pattern's height: a trade that reaches its target makes about +1 R before costs; the stop was on average 0.85 R away (smaller patterns).
  • Four versions: HS-LS-3, HS-L-3, HS-LS-6, HS-L-6: both sizes, with tops and inverse patterns or with inverse patterns only (gold rose about 11-fold over these years, from $384 to $4,110 an ounce in this file, which favours buying). Four versions of a strategy not tested before on the site, so the development t-statistic bar is 2.0.

How many patterns this finds: the smaller size found 451 valid patterns in 22 years (221 tops and 230 inverse patterns), of which 282 broke their neckline in time; the larger size 211 and 138. Most zigzag shapes are not clean enough to count; that is the point of a strict definition.

02Data and costs

Gold (XAUUSD), the 1-minute bid history of an IC Markets MetaTrader 4 demo server, from its first bar (11 June 2004) to 7 October 2026, built into 15-minute bars on the New York clock; patterns from the 2,001st bar (mid-July 2004), once the volatility had a month of data. Costs: $0.30 per ounce per round trip, as in every gold test on the site, with no slippage, which is optimistic. Overnight financing is shown in two scenarios (section 05). 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 hand-worked cases and an independent re-implementation that matched every zigzag pivot, every pattern and every trade of all four versions (hs_selftest_result.txt). In its first run two hand-made cases failed because the helper that built their prices left the first bar empty; the helper was corrected before any result was computed.

03Results

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
HS-LS-3Smaller patterns (cut-off 3): tops sold, inverse patterns bought279+0.20 R+46 R+0.16 R59.5% (54% to 65%)1.55Buried
HS-L-3Smaller patterns: inverse patterns bought only142+0.20 R+24 R+0.17 R59.2% (51% to 67%)1.56Buried
HS-LS-6Larger patterns (cut-off 6): tops sold, inverse patterns bought135-0.02 R-6 R-0.04 R44.4% (36% to 53%)0.90Buried
HS-L-6Larger patterns: inverse patterns bought only64+0.04 R+2 R+0.03 R45.3% (34% to 57%)1.08Buried
-0 R20 R40 R200620102014201820222026validationholdout*HS-LS-3HS-L-3HS-LS-6HS-L-6

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 2026 (trades)Development tValidation PF
HS-LS-3+9.7 R (90)+21.8 R (93)+14.5 R (96)1.261.87
HS-L-3+9.2 R (41)+8.1 R (49)+6.4 R (52)1.951.57
HS-LS-6-3.5 R (43)+1.8 R (39)-4.0 R (53)-0.601.13
HS-L-6+3.0 R (16)+1.1 R (20)-2.4 R (28)0.961.17

How the trades ended

VariantReached the targetStopped outCame back to the neckline firstAverage heightDistance to the stopMedian hours heldCost per trade
HS-LS-360.9%39.1%81.0%$14.470.85 R80.038 R
HS-L-360.6%39.4%81.7%$13.500.82 R80.037 R
HS-LS-645.9%54.1%87.4%$26.410.80 R210.020 R
HS-L-648.4%51.6%84.4%$31.950.80 R190.017 R

The smaller patterns reached their target in 60.9% of trades. Bulkowski's statistics for head and shoulders tops on stocks, on daily charts, give 51% reaching the target and a 68% “pullback rate” (price returning to the neckline after the break); on 15-minute gold, 81.0% of the trades came back to the neckline at some point before they ended, and still most reached the target. The larger patterns reached it in only 45.9% of trades.

04Why the first period was weaker

The smaller patterns, tops and inverse patterns together (HS-LS-3), period by period:

PeriodTradesAverage heightReached the targetGross per tradeCost per tradeNet per trade
Development 2004 to 201290$8.4560.0%+0.16 R0.051 R+0.11 R
Validation 2013 to 201993$8.2163.4%+0.28 R0.044 R+0.23 R
Holdout* 2020 to 202696$26.1859.4%+0.17 R0.020 R+0.15 R

Two things made 2004 to 2012 the weakest period: a lower gross result per trade, and patterns so small in dollars that the same $0.30 cost weighed two to three times more than in recent years, when gold's 15-minute patterns grew with its price. The share of trades reaching the target was close to 60% in all three periods.

05Year by year, next to gold

YearGold, first open → last closeHS-LS-3 (trades)HS-L-3 (trades)HS-LS-6 (trades)HS-L-6 (trades)
2004 (from July)$384 → $437 (+14%)+1.1 R (3)-0.7 R (1)––
2005$437 → $515 (+18%)+0.1 R (11)+1.5 R (4)-2.1 R (9)-0.4 R (1)
2006$517 → $636 (+23%)+4.4 R (10)+2.0 R (7)+0.9 R (6)+1.1 R (2)
2007$638 → $832 (+30%)-1.8 R (12)-0.3 R (7)-3.3 R (4)-0.9 R (1)
2008$841 → $867 (+3%)-0.3 R (12)+0.5 R (5)+1.7 R (8)+1.6 R (6)
2009$874 → $1,098 (+26%)+5.9 R (10)+1.1 R (4)-0.5 R (6)+0.3 R (3)
2010$1,095 → $1,408 (+29%)-0.5 R (13)+2.8 R (5)-0.9 R (1)–
2011$1,416 → $1,564 (+10%)-2.4 R (11)-0.3 R (2)+2.2 R (4)+0.9 R (1)
2012$1,567 → $1,675 (+7%)+3.3 R (8)+2.7 R (6)-1.6 R (5)+0.3 R (2)
2013$1,673 → $1,208 (-28%)+3.8 R (9)+2.3 R (5)-1.2 R (5)-2.1 R (4)
2014$1,225 → $1,187 (-3%)-2.0 R (13)-2.1 R (7)+1.9 R (5)+1.8 R (3)
2015$1,187 → $1,061 (-11%)-1.8 R (6)-0.6 R (3)-0.9 R (6)-0.6 R (2)
2016$1,065 → $1,151 (+8%)+7.3 R (18)+0.5 R (10)+1.6 R (3)+0.8 R (2)
2017$1,152 → $1,302 (+13%)+6.7 R (18)+4.3 R (10)+1.9 R (6)+1.8 R (2)
2018$1,310 → $1,279 (-2%)+5.1 R (18)+2.8 R (7)-0.7 R (7)-0.9 R (5)
2019$1,282 → $1,520 (+19%)+2.7 R (11)+0.8 R (7)-0.9 R (7)+0.2 R (2)
2020$1,520 → $1,893 (+25%)+2.4 R (18)-0.3 R (8)-0.8 R (6)-0.8 R (4)
2021$1,909 → $1,828 (-4%)+1.0 R (13)+2.0 R (8)+0.9 R (10)-0.1 R (3)
2022$1,831 → $1,824 (-0%)+1.2 R (15)-0.1 R (11)-2.6 R (6)-2.1 R (5)
2023$1,827 → $2,063 (+13%)+4.0 R (10)+3.7 R (6)-1.9 R (7)-0.7 R (4)
2024$2,063 → $2,625 (+27%)+7.3 R (12)+4.9 R (7)+1.3 R (7)+1.8 R (2)
2025$2,624 → $4,316 (+64%)-0.4 R (12)-0.8 R (3)+2.4 R (8)+1.9 R (4)
2026 (to 7 Oct)$4,319 → $4,110 (-5%)-1.0 R (16)-3.1 R (9)-3.2 R (9)-2.5 R (6)

HS-LS-3 ended 15 of the 23 calendar years positive; 2025 (-0.4 R) and 2026 so far (-1.0 R) were negative. With about a dozen trades a year, a single year says little either way.

Long, short, closed-trade drawdown and financing

VariantLongs (inverse): trades / gross / netShorts (tops): trades / gross / netDrawdown, closed tradesWorst open loss
HS-LS-3140 / +29.8 R / +24.7 R139 / +26.8 R / +21.3 R-7.1 R-1.76 R
HS-L-3142 / +28.9 R / +23.7 R–-4.6 R-1.76 R
HS-LS-663 / +3.2 R / +2.1 R72 / -6.2 R / -7.9 R-8.2 R-2.20 R
HS-L-664 / +2.8 R / +1.7 R–-4.6 R-1.40 R
VariantWithout financing (verdict)Scenario A: 3% a yearScenario B: today's swap
HS-LS-3+46 R+44 R+45 R
HS-L-3+24 R+22 R+18 R
HS-LS-6-6 R-7 R-5 R
HS-L-6+2 R+1 R-2 R

Trades last hours, not days (a median of 8 hours for the smaller patterns), so financing changes little. 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 of the 22 years; it is not the historical cost.

06Is it the pattern or chance?

The moved-entry control: every real entry 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 volatility at the new time (so a small pattern of 2004 moved to 2024 keeps its size relative to the market); same costs; 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 95thPercentile (95 needed)
HS-LS-3279+0.16 R224-0.03 R-0.12 R to +0.05 R100.0
HS-L-3142+0.17 R113-0.02 R-0.15 R to +0.11 R99.6
HS-LS-6135-0.04 R110-0.02 R-0.15 R to +0.10 R37.2
HS-L-664+0.03 R52+0.02 R-0.15 R to +0.20 R51.2

The same trades placed at random times made -0.03 R a trade, about the cost, so their timing alone earned nothing before costs. The smaller patterns' breaks made +0.16 R, above every one of the 500 runs (HS-LS-3) and above 99.6% of them (inverse patterns only). The larger patterns sat in the middle of their controls.

07The gates

VariantTrades1. PF ≥ 1.2 in validation2. ≥ 50 trades in each period3. t ≥ 2.0 on development4. Above the 95th percentile of the moved-entry control5. Positive without the 10 best trades6. Holdout net positive (already used)
HS-LS-3279passpassfailpasspasspass
HS-L-3142passfailfailpasspasspass
HS-LS-6135failfailfailfailfailfail
HS-L-664failfailfailfailfailfail

HS-LS-3 failed gate 3 only. HS-L-3, with inverse patterns only, failed gate 3 (development t 1.95) and gate 2: 41 and 49 trades in the first two periods, 50 needed.

08The data-gap check

Our rule 3 removes the trades that were open across a suspect or unclear gap in the data and recomputes every gate. No verdict changed:

VariantTradesRemovedNet per tradeVerdict
HS-LS-327932+0.16 R → +0.19 RBuried → Buried
HS-L-314211+0.17 R → +0.18 RBuried → Buried
HS-LS-613523-0.04 R → -0.02 RBuried → Buried
HS-L-6649+0.03 R → +0.04 RBuried → Buried

09Verdict by variant

VariantCauseGates failedVerdict
HS-LS-3No proven edge3Buried
HS-L-3No proven edge2, 3Buried
HS-LS-6No proven edge1, 2, 3, 4, 5, 6Buried
HS-L-6Fragile1, 2, 3, 4, 5, 6Buried

No proven edge (HS-LS-3, HS-L-3, HS-LS-6) means a convincing edge was not demonstrated under our gates, not that none exists: HS-LS-3 came within one gate of passing. Fragile (HS-L-6): positive overall, but not without its ten best trades. Not tested: other definitions of the pattern, a retest entry, a stop beyond the head, volume, other markets and timeframes.

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

What the results show

  • Defined by a published algorithm instead of by eye, the smaller head-and-shoulders patterns on 15-minute gold picked better moments than chance: their trades beat all 500 runs of a control that placed the same trades at other times (+0.16 R a trade after costs, against a control median of -0.03 R).
  • The result held in each of our three periods and on both sides, tops sold (+21 R) and inverse patterns bought (+25 R). It still failed one gate: in 2004 to 2012 alone, 90 trades averaging +0.11 R were not enough evidence (t 1.26; 2.0 needed).
  • The larger patterns, which take days to form, did not work: -6 R over 135 trades, no better than the same trades at random times.

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; only a forward test can give one. None has been started.
  • Other definitions of the pattern, an entry on a retest of the neckline, a stop beyond the head, other markets and other timeframes. We tested one published definition at two sizes.
  • Slippage. Every stop filled at its level; around news, real stops on gold fill worse.

Why it was buried

Our protocol asks for proof in the first period alone before a result can count, so that a strategy cannot pass on the strength of the years we looked at last. The smaller patterns were positive from 2004 to 2012 too, but with only 90 trades, a gross +0.16 R a trade (against +0.28 R from 2013 to 2019) and patterns so small in dollars ($8.45 on average) that our $0.30 cost took 0.051 R of each trade. That is a promising result, not a proven one, and 15 positive years out of 23, with 2025 and 2026 negative so far, leave room for luck.

What you can apply to your own tests

  • Write the pattern down before you test it. By eye, everyone sees a different head and shoulders, and a rule you can change after the fact will always find one that worked.
  • Compare with the same trades at random times. Here the smaller patterns passed that test clearly and the larger ones did not, which a profit total alone would not have shown.
  • Check each period on its own. A good 22-year total can rest on the later years; this one was positive everywhere but thin at the start.

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.

FAQCommon questions

Does the head and shoulders pattern work?

On 15-minute gold, the smaller patterns came close: +0.16 R a trade after costs over 279 trades from 2004 to 2026, positive in each of our three periods and better than all 500 runs of a control that placed the same trades at random times. They still failed our development gate (t 1.26 on 2004 to 2012; 2.0 needed), so the result is not proven. Larger patterns lost 0.04 R a trade.

What is the success rate of the head and shoulders pattern?

In our test, 61% of the trades on the smaller patterns reached the textbook target (the pattern's height measured from the neckline) before the stop beyond the right shoulder; for the larger patterns 46%. Bulkowski reports 51% of head and shoulders tops on stocks reaching the target.

How do you trade a head and shoulders pattern?

The textbook way, which we tested: wait for a close beyond the neckline (the line through the two troughs between the shoulders), enter after it, put the stop beyond the right shoulder and the target at the distance from the head to the neckline, measured from the neckline at the break. Sell a top, buy an inverse pattern.

Does the inverse head and shoulders work?

On 15-minute gold, buying only the inverse patterns made +0.17 R a trade over 142 trades, also better than random timing, but with too few trades in each period to pass our gates. In the version that traded both, the inverse patterns made 25 R and the tops 21 R.

How was the head and shoulders pattern tested?

On gold (XAUUSD) 15-minute bars from 2004 to 2026, with 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. The pattern follows Osler and Chang's published computer definition at two sizes. Read the protocol.

10Check our arithmetic

Frozen specificationThe zigzag, the pattern rules, the break, the trade, costs, periods, gates and control, dated before any pattern was computed.
hs_spec.md
CodeThe engine (its readings of the rules at the top), the independent re-implementation, the self-test and the run (node hs_run.js). Needs your own MT4 gold history.
hs_lib.js · hs_ref.js · hs_selftest.js · hs_run.js
Shared code it usesThe MT4 loader, bars, statistics, control and gold helpers.
control_audit_lib.js · em_lib.js · fx_data.js · gh_lib.js · gx_lib.js · hourly_lib.js · ma_lib.js · rb_lib.js · rs_lib.js · rsi2_protocol.js
ResultsSelf-test result, the console output of the run and all numbers as one file.
hs_selftest_result.txt · hs_results.txt · hs_summary.json
Trade logs (CSV)Every trade of the four versions: the break, entry and exit (New York time), prices, stop, target, the pattern's height, the exit reason, gross and net R, the worst open loss, whether it came back to the neckline, and both financing scenarios.
HS-LS-3 · HS-L-3 · HS-LS-6 · HS-L-6
Data recordFile hashes and the gap audit of the gold file.
data_manifest.md · data_holes_xau.json

Code provenance: our own code, written from the published description of the algorithm and the rules fixed in the specification. No third-party source code is used or published.

11Data notes

Clock. The file's time labels are an hour early in many weeks of 2004 to 2010 (our clock audit). The bars are cut on quarter hours and nothing in these rules depends on the time of day, so a shifted label moves whole bars without changing them.

Gaps. See section 08. Source. A broker's demo history, not an exchange record; bid prices; costs constant across years, which weighs on the early years, when the patterns were small in dollars.

12Corrections

17 Oct 2026: the heading of the long-and-short tables in section 05 now says that the drawdown shown is on closed trades, as the table column always did. No number or result changed. 18 Oct 2026, navigation: added links to the new guide that compares all 11 gold strategy tests. No result changed. 22 Oct 2026, navigation: added a link to the new guide comparing trading costs across all our tests. No result changed. 22 Oct 2026, navigation: added a link to the new guide comparing trend following and mean reversion across all our tests. No result changed.

+More tests and guides