Strategies we backtested head and shoulders pattern

Tested by BacktestingMax

Head and shoulders pattern backtest

Does the head and shoulders pattern work?

No. We backtested the head and shoulders top, the pattern's sell signal, on 8 currency pairs, gold and silver. We used 1-hour, 4-hour and daily charts, from 2007 to 2025. After trading costs, it broke even. The pattern is three peaks: the highest in the middle (the head), with a lower one on each side (the shoulders). Our standard rules sold short (sold first, to buy back lower) when a candle closed below the neckline, the line through the two dips between the peaks. The stop-loss was at the right shoulder. The take-profit was the measured move: as far below the neckline as the head is above it. 1R is the distance from the entry to the stop-loss, and every trade was sized so that losing 1R cost 1% of the account. The 2,166 trades lost 0.002R per trade on average, almost exactly zero, and 33.8% of them reached the take-profit. On 1-hour charts, 4 of the 10 markets made money in both 2007–2019 and 2020–2025: GBP/USD, USD/CHF, EUR/JPY and gold. But with the 10 markets added together, the 1-hour trades lost money in 2020–2025. None of four common changes made the pattern clearly profitable.

30 backtests 2007–2025 Trading costs included Tested 2 November 2026

Where it worked 30 backtests
Made money
6
of 30 tests, with the standard rules
Made money in both periods
4
2007–2019 and again 2020–2025
Best backtest
+37%
Gold, 1-hour chart: account growth 2007–2025
With a take-profit at half the measured move
5
tests made money in both periods, compared with 4 with the standard rules

Made money in both periods

  • GBP/USD, 1-hour
  • USD/CHF, 1-hour
  • EUR/JPY, 1-hour
  • Gold, 1-hour

The results

Results on every market

Each box shows one backtest of the head and shoulders pattern with the standard rules, from 2007 to 2025, after trading costs: the % result, and a small chart of the account balance. The solid line is the account balance and the dashed line is the starting balance. Green results made money; red results lost money. Under each result: whether it made money in both 2007–2019 and 2020–2025, or passed all four of our checks (see "How a test passes" further down).

Market 1-hour 4-hour daily
EUR/USD −17% Lost money −16% Too few trades +2% Too few trades
GBP/USD +13% Made money in both periods +7% Too few trades −7% Too few trades
USD/JPY −4% Lost money −9% Too few trades −2% Too few trades
AUD/USD +10% Made money overall, lost in one period +5% Too few trades +7% Too few trades
USD/CAD −33% Lost money −4% Too few trades 0.0% Too few trades
USD/CHF +5% Made money in both periods −6% Too few trades −0.9% Too few trades
EUR/JPY +9% Made money in both periods +4% Too few trades −1% Too few trades
GBP/JPY +24% Made money overall, lost in one period +16% Too few trades +2% Too few trades
Gold +37% Made money in both periods −17% Too few trades −2% Too few trades
Silver −29% Lost money +3% Too few trades −1% Too few trades
All the numbers, test by test
Market Chart Trades Win rate Profit factor Result Max drawdown 2007–2019 2020–2025 Monte Carlo drawdown Trading costs
EUR/USD 1-hour 176 29.5% 0.87 −16.5% −27.1% −3.8% −13.2% −37.7% $576
EUR/USD 4-hour 38 21.1% 0.37 −15.8% −20.5% −18.4% +3.2% −19.4% $33
EUR/USD daily 5 40% 1.68 +1.7% −1.5% −1.5% +3.3% — $2
GBP/USD 1-hour 180 35% 1.10 +13.1% −11.6% +12.7% +0.4% −25.5% $612
GBP/USD 4-hour 49 49% 1.30 +7.4% −7.5% −2.4% +10.0% −9.4% $56
GBP/USD daily 10 10% 0.16 −6.6% −6.6% −4.3% −2.4% — $4
USD/JPY 1-hour 184 33.7% 0.97 −3.5% −21.8% −11.9% +9.5% −30.3% $546
USD/JPY 4-hour 44 27.3% 0.69 −9.4% −13.2% −3.3% −6.3% −16.8% $71
USD/JPY daily 9 33.3% 0.61 −2.2% −5.5% −0.4% −1.9% — $5
AUD/USD 1-hour 170 35.3% 1.09 +10.3% −12.1% +15.2% −4.3% −26.0% $667
AUD/USD 4-hour 43 34.9% 1.16 +4.5% −7.4% +5.2% −0.7% −12.8% $61
AUD/USD daily 8 62.5% 3.53 +6.6% −1.0% +2.5% +4.0% — $3
USD/CAD 1-hour 168 26.2% 0.71 −32.5% −44.8% −22.7% −12.7% −43.1% $731
USD/CAD 4-hour 41 31.7% 0.84 −4.2% −14.6% −7.7% +3.8% −14.6% $57
USD/CAD daily 5 40% 0.99 0.0% −1.9% +1.9% −1.9% — $3
USD/CHF 1-hour 164 32.9% 1.04 +4.8% −18.1% +0.4% +4.3% −28.3% $1,039
USD/CHF 4-hour 37 29.7% 0.75 −6.1% −10.8% −4.2% −1.9% −15.2% $85
USD/CHF daily 7 42.9% 0.77 −0.9% −1.9% −0.6% −0.3% — $7
EUR/JPY 1-hour 152 38.2% 1.09 +8.6% −15.4% +7.7% +0.8% −22.4% $471
EUR/JPY 4-hour 35 42.9% 1.20 +4.1% −6.7% +10.1% −5.5% −8.9% $48
EUR/JPY daily 6 33.3% 0.65 −1.3% −2.6% +1.4% −2.6% — $2
GBP/JPY 1-hour 173 37% 1.17 +23.8% −17.2% +33.2% −7.1% −22.9% $931
GBP/JPY 4-hour 35 42.9% 1.74 +16.1% −5.7% +14.0% +1.9% −9.0% $76
GBP/JPY daily 4 50% 2.11 +1.8% −0.9% +1.8% 0.0% — $3
Gold 1-hour 162 40.1% 1.30 +37.3% −7.4% +33.3% +3.0% −20.1% $932
Gold 4-hour 33 15.2% 0.28 −16.7% −18.6% −15.5% −1.4% −19.5% $63
Gold daily 7 28.6% 0.56 −1.6% −1.6% −0.1% −1.5% — $2
Silver 1-hour 176 31.2% 0.76 −29.1% −41.5% −20.5% −10.8% −43.0% $2,103
Silver 4-hour 42 35.7% 1.11 +2.7% −4.7% +0.9% +1.7% −11.8% $220
Silver daily 3 33.3% 0.36 −1.1% −1.7% −1.1% 0.0% — $4

Profit factor is the money won divided by the money lost. Above 1 means the test made money. Max drawdown is the biggest fall from the highest balance. 2007–2019 and 2020–2025 show the result in each period on its own. Monte Carlo drawdown: we shuffled the trades into a random order 1,000 times; in 95% of those runs, the worst drawdown was this number or less. Result is the change in the account, with the risk of each trade set to 1% of the account at that time.

The account balance

The best test and the middle test

Best test Gold, 1-hour chart +37.3% from 2007 to 2025
Middle test (median): half of the 30 did better, half did worse USD/CAD, daily chart 0.0% from 2007 to 2025

What we found

What the 30 backtests show

  1. The head and shoulders top was rare on 4-hour and daily charts. In 19 years, the rules found about 9 patterns a year on each market on 1-hour charts, but only about 2 a year on 4-hour charts. On daily charts, they found 75 on all 10 markets together. So only the 10 tests on 1-hour charts had the 100 trades we need to judge one test. Only these 10 can count as making money in the 'Where it worked' box, so it shows 6 of 30. 6 of the 10 tests on 1-hour charts made money from 2007 to 2025, and 4 made money in both 2007–2019 and 2020–2025: GBP/USD, USD/CHF, EUR/JPY and gold. The best test was gold, where the account grew 37.3% from 2007 to 2025. But with the 10 markets added together, the 1-hour trades made +0.037R per trade in 2007–2019 and lost 0.055R per trade in 2020–2025. So the 4 markets were the exception: after 2019, the 1-hour trades as a whole lost money.

  2. Where the stop-loss went changed how often the trades won, but not what they made. With the stop-loss at the right shoulder (the standard rules), 33.8% of the trades reached the take-profit. For half of the trades, the take-profit was more than 2.07R from the entry: more than 2.07 times as far as the stop-loss. So winning about 1 trade in 3 was just enough to break even. With the stop-loss at the head, the highest point of the pattern, 51.3% of the trades reached the take-profit. But the stop-loss was further away, so with the same 1% risk each trade was smaller. The take-profit was then less than 0.98R from the entry for half of the trades. The average trade made +0.007R, compared with −0.002R with the standard rules. On 1-hour charts, 4 markets made money in both 2007–2019 and 2020–2025 with either stop-loss: GBP/USD, USD/CHF, EUR/JPY and gold. With the stop-loss at the head, 2 of them passed all four of our checks (see 'How a test passes' further down). On GBP/USD, the account grew 23.2% from 2007 to 2025, and on gold 23.5%.

  3. After the break, price often fell part of the way to the measured move, but less often all the way. We followed price after each of the 2,279 neckline breaks the rules found, with no take-profit, until a candle's high reached the right shoulder (see 'After the break' below). Price fell at least half of the measured move after 53.5% of the breaks, but the full measured move after only 34.6%. With the take-profit at half the measured move, 52.2% of the trades reached it, compared with 33.8% with the standard rules. But each win made less, so the average trade stayed close to zero: +0.005R, compared with −0.002R. Of our four changes, this one made money in the most tests in 2007–2019, the years we used to choose the best change.

  4. Three things textbooks look for in a head and shoulders top did not make the trades better (see 'Textbook signs' below). Textbooks describe the pattern as the end of an uptrend. But most patterns broke the neckline while price was below the 200 EMA, a moving average of the last 200 candles: 1,332, compared with 940 above it. So the longer trend was often already down. When the candle that broke the neckline closed above the 200 EMA, after an uptrend, the trades lost 0.004R per trade. Below it, they made +0.0005R. Trading only after an uptrend, one of our four changes, made +0.036R per trade in 2007–2019 but lost 0.106R per trade in 2020–2025. Textbooks also call a right shoulder lower than the left one, and a neckline that falls from the first dip to the second, bearish signs. Neither helped. With a falling neckline, 44.5% of the trades reached the take-profit, compared with 30.7% with a rising one. But the take-profit was closer, so the average trade lost 0.076R.

  5. Waiting for a retest, for price to come back up to the neckline, made +0.063R per trade in 2007–2019, compared with +0.013R with the standard rules. In 2020–2025, it lost 0.037R per trade, about the same as the standard rules (0.040R). Its whole gain came from 263 trades where price barely reached the neckline: without them, it lost 0.018R per trade from 2007 to 2025 (see 'Trade by trade' below).

After the break

Price fell half of the measured move after about half of the breaks, and the full move after 1 in 3

We followed price after each of the 2,279 neckline breaks that the standard rules found on the 30 tests, from 2007 to 2025, with no take-profit. Each bar is the share of breaks after which price fell at least that far below the neckline, before a candle's high reached the right shoulder. The right shoulder is the stop-loss of the standard rules. The measured move is the usual take-profit: as far below the neckline as the head is above it.

  • A quarter of the measured move1,657 out of 2,279 breaks 72.7%
  • Half of the measured move1,219 out of 2,279 53.5%
  • Three quarters of the measured move955 out of 2,279 41.9%
  • The full measured move788 out of 2,279 34.6%
  • One and a half times the measured move580 out of 2,279 25.4%
  • Twice the measured move469 out of 2,279 20.6%

We checked the chart's candles from the open after the candle that broke the neckline. When a candle reached the right shoulder, we stopped there and did not count that candle's low. The breaks include 113 that the standard rules did not trade. 102 of them came while a trade was already open. 11 were skipped because of the trade size, or because the breaking candle had already closed below the take-profit. After 30 breaks, price did not go back above the right shoulder before the end of 2025.

Textbook signs

Three things textbooks look for did not make the trades better

Each row is a group of the 2,166 trades of the standard rules, on all 30 tests, from 2007 to 2025, after trading costs. In each pair of rows, the first row is what textbooks look for. 'Reached the take-profit' is the share of trades that reached the measured move before the stop-loss at the right shoulder. 'Take-profit distance' is how far the take-profit was from the entry, in R, for the median trade: half of the trades aimed for less, half for more. 'Average trade' is the result of one trade, on average, in R.

Group Trades Reached the take-profit Take-profit distance Average trade
The candle that broke the neckline closed above the 200 EMA: the pattern ended an uptrend 906 31.2% 2.29R −0.004R
The candle that broke the neckline closed below the 200 EMA: the longer trend was already down 1,253 35.6% 1.89R +0.0005R
Right shoulder lower than the left shoulder 1,018 34.2% 1.96R −0.019R
Right shoulder higher than the left shoulder 1,148 33.4% 2.15R +0.013R
Falling neckline: the second dip lower than the first 485 44.5% 1.19R −0.076R
Rising neckline: the second dip higher than the first 1,681 30.7% 2.45R +0.019R

The 200 EMA is a moving average of the last 200 candles that gives more weight to recent candles. 7 trades came in the first 200 candles of a test, before the 200 EMA had enough candles, so the two 200 EMA rows add up to 2,159 trades. The change 'Only after an uptrend' made exactly the 906 trades of the first row. With a falling neckline, the neckline is lower when price breaks it, so the entry is further below the right shoulder. The stop-loss is then further away, and the take-profit closer, in R.

Trade by trade

Every version made money per trade in 2007–2019 and lost money in 2020–2025

Each row adds up every trade of one version on all 30 tests (10 markets, each on 1-hour, 4-hour and daily charts), after trading costs. In the table, each change is one version. 'Average trade' is the result of one trade, on average, in R. 'Reached the take-profit' is the share of trades that closed at the take-profit. Each trade counts in the period in which it closed.

Version Trades Reached the take-profit Average trade, 2007–2025 2007–2019 2020–2025
Standard rules 2,166 33.8% −0.002R +0.013R −0.040R
Wait for a retest of the neckline 1,807 26.2% +0.034R +0.063R −0.037R
Stop-loss at the head 2,038 51.3% +0.007R +0.016R −0.015R
Only after an uptrend (above the 200 EMA) 906 31.2% −0.004R +0.036R −0.106R
With a take-profit at half the measured move 2,158 52.2% +0.005R +0.016R −0.023R

The versions made different numbers of trades. In each test, only one trade is open at a time, so a version whose trades last longer skips more patterns. The retest traded only when price came back to the neckline. The uptrend change traded only the patterns whose breaking candle closed above the 200 EMA. The retest's row includes 263 trades where price went less than one spread above the order's price. The spread is the gap between the buy price and the sell price, and a broker may not fill a limit order when price only touches it. Without them, the retest lost 0.018R per trade.

The strategy

What the head and shoulders pattern is

The head and shoulders is a chart pattern that many traders read as the end of an uptrend. Price makes three peaks. The middle peak, the head, is the highest. The peaks on each side, the left shoulder and the right shoulder, are lower and at about the same height. Between the peaks are two dips. The straight line through the two dips is the neckline. When a candle closes below the neckline, the pattern is complete, and traders sell short: they sell first and buy back later, so the trade makes money if price falls. Traders usually put the stop-loss at the right shoulder or at the head. The usual target is the measured move: as far below the neckline as the head is above it. The mirror image, three dips with the lowest one in the middle, is the inverse head and shoulders, a buy signal. This page tests only the head and shoulders top, the sell signal. Most traders find the pattern by eye, so two traders can see different patterns on the same chart. To test it, we wrote exact rules, built from swing points and the ATR. A swing high is a candle whose high is higher than the highs of the 5 candles before it and the 5 candles after it. A swing low is the mirror image. ATR (average true range) is the average size of a candle over the last 14 candles. It grows and shrinks with volatility, how far price moves, so a rule written in ATR means the same thing on every market and chart.

Swing points
5 candles on each side, so a swing point is known 5 candles after it
Head
At least 1 × ATR(14) higher than each shoulder
Shoulders
Within 1 × ATR(14) of each other, and both above the neckline
Neckline
The straight line through the two dips. It can slope up or down
Entry
Sell short at the open of the candle after the first close below the neckline
Stop-loss
At the right shoulder's high. It does not move. In a typical trade (the median), it was 2.15 × ATR(14) above the entry. A stop-loss does not protect against a gap, a jump in price between two candles. When the market opened after the French election on Sunday 23 April 2017, EUR/USD opened far above one trade's stop-loss. That trade lost 6.33R
Take-profit
The measured move: the head's height above the neckline, measured straight below the head, taken from the neckline's price on the candle that closed below it. For half of the trades, it was more than 2.07R from the entry: more than 2.07 times as far as the stop-loss
Risk per trade
1% of the account balance when the trade opens. The account started at $10,000
Stop-loss and take-profit in one candle
The test looks at 1-minute prices to see which one price reached first. If it reached both in the same minute, the test counts the stop-loss
Trading costs
The spread: the gap between the buy price and the sell price. On the currency pairs, the spread is 0.8 pips on EUR/USD, 0.9 on USD/JPY, 1.0 on AUD/USD and 1.2 on GBP/USD. The spread is 1.3 pips on USD/CAD, 1.4 on EUR/JPY, 1.5 on USD/CHF and 2.5 on GBP/JPY. A pip is 0.0001, or 0.01 on the pairs with the Japanese yen. The spread is $0.30 an ounce on gold and $0.020 on silver. The silver spread is wider than our backtest engine's own, to match a typical retail broker. The entry is a market order (an order that fills at the next price), so it pays half the spread. A trade that closes at the stop-loss pays the other half. The take-profit is a limit order (an order that waits at a set price), so it pays no spread, and the test fills it as soon as price touches it. In 98.4% of the take-profit exits of the standard rules, price went at least one spread past it, so a broker would very likely have filled those too. With the retest change, the entry is a limit order too. With the standard rules, the costs took 0.044R per trade, a little more than the +0.041R the trades made before costs. Silver paid the most: 0.116R per trade, because its spread is large compared with its usual stop-loss distance. No commission
Smallest trade size
Trade sizes are rounded down to the market's smallest step: 1,000 units of a currency pair, 1 ounce of gold and 50 ounces of silver. So when the stop-loss was far from the entry, a trade could risk less than 1%. With the standard rules, 162 out of the 2,166 trades risked less than 0.9%, 51 of them on silver and 31 on gold. 6 patterns were not traded, because even the smallest size would have risked more than 1%. 3 were on the silver daily chart, and 1 each on the GBP/JPY daily chart, the silver 1-hour chart and the gold 1-hour chart. On 6 trades, the stop-loss was very close to the entry, so a 1% risk needed a bigger trade than our backtest engine allows. The limit is 30 times the account for currency pairs and 20 times for gold and silver, and these trades used the biggest size allowed. With the stop-loss at the head, further from the entry, 18 patterns were not traded because of the smallest size
Overnight fees
Not included. Brokers charge (or sometimes pay) a fee for each night a trade stays open. With the standard rules, half of the trades closed within 12 hours on 1-hour charts, 3.2 days on 4-hour charts and 28.5 days on daily charts
Price data
CFD prices: the prices a broker quotes for a CFD (contract for difference), the product most brokers outside the US offer for trading these markets. The test starts in 2007, because our silver prices have gaps before that. We left out stock indices, because our index prices on charts below daily are reliable only from 2019. The rules skip any candle that starts on a Friday at 17:00 New York time or later. In some years, a few minutes of prices after the weekly close make a tiny extra candle. The rules also skip any candle with no price movement, which marks a market holiday

The rules we tested

  1. Find the swing points. A swing high is a candle whose high is higher than the highs of the 5 candles before it and the 5 candles after it. A swing low is a candle whose low is lower than the lows of the 5 candles on each side. So a swing point is known only 5 candles later. Highs and lows take turns: of two swing highs in a row, only the higher one counts, and of two swing lows in a row, only the lower one.
  2. The pattern uses the last four swing points. In order, they are a swing high (the left shoulder), a swing low (the first dip), a swing high (the head) and a swing low (the second dip). The right shoulder is the highest price after the second dip, up to the candle that closes below the neckline. The neckline is the straight line through the two dips. It can slope up or down.
  3. ATR(14) is the average size of a candle over the last 14 candles, measured on the candle that closes below the neckline. The head must be at least 1 ATR higher than each shoulder. The two shoulders must be within 1 ATR of each other, and both must be above the neckline.
  4. Sell short at the next candle's open when a candle closes below the neckline. Selling short means you sell first and buy back later, so the trade makes money if price falls. Only the first close below the neckline after the first dip counts. If that first close came before the second dip was known, or if the pattern did not meet the rules above on that candle, there is no trade. The pattern is dropped when the next swing low is known.
  5. Put the stop-loss at the right shoulder's high. It does not move.
  6. Put the take-profit at the measured move. Measure the head's height above the neckline, straight below the head. The take-profit is that far below the neckline's price on the candle that closed below the neckline.
  7. Size every trade so that a loss at the stop-loss costs 1% of the account when the trade opens. The distance from the entry to the stop-loss is 1R. In each test, only one trade is open at a time: a pattern that breaks the neckline while a trade is open is skipped.

The method

How we tested it

The test

Markets
EUR/USD, GBP/USD, USD/JPY, AUD/USD, USD/CAD, USD/CHF, EUR/JPY, GBP/JPY, Gold and Silver
Charts
1-hour, 4-hour and daily candles
Dates
January 2007 to December 2025
Account
$10,000, risking 1% of the account on each trade
Trading costs
Included. Every trade pays that market's normal trading cost: the spread, which is the gap between the buy price and the sell price.

How a test passes

We call a test passed only if it meets all four checks. A strategy can make money in one backtest and still fail one of these checks.

  • At least 100 trades. With fewer trades, a good result could be luck.
  • It made money from 2007 to 2019 and again from 2020 to 2025. This shows whether the strategy kept working in the newer years, not only in the older ones.
  • A profit factor (the money won divided by the money lost) of at least 1.2 from 2020 to 2025, after trading costs.
  • In 95% of 1,000 random shuffles of the trades, the account must not fall more than 30% from its highest point.

Improvements

Can the head and shoulders pattern be improved?

We tried four changes that traders often make, one at a time, on the same 30 tests. In the table, each change is one version. Two of them change where the trade ends: a stop-loss at the head, and a take-profit at half the measured move. One changes the entry: waiting for a retest of the neckline. One is a filter: trading only after an uptrend, as textbooks describe the pattern. If you pick the best change and judge it on the same years you used to pick it, it almost always looks better than it really is. So we picked the best change using 2007–2019 only: the change that made money in the most tests. Then we checked it on 2020–2025, the years we did not use to pick it. Every 4-hour and daily test had fewer than 100 trades, and so did every test of the uptrend change. These tests count when we pick the best change, but not in 'Made money in both periods' or 'Passed all four checks'.

Version Made money 2007–2019years used to pick the best version Made money 2020–2025years not used to pick it Made money in both periods Passed all four checks
Standard rules The rules under 'The rules we tested', with nothing changed. 14 of 30middle test −0.2% 12 of 30middle test −0.5% 4 0
Wait for a retest of the neckline After the candle that closes below the neckline, place a sell limit order (an order that waits at a set price) at the neckline's price on that candle. It waits up to 10 candles, and it is cancelled if price reaches the take-profit first. The stop-loss and the take-profit stay the same. 17 of 30middle test +0.6% 10 of 30middle test −1.0% 2 0
Stop-loss at the head The stop-loss goes at the head's high instead of the right shoulder's high. The entry and the take-profit stay the same. With the same 1% risk, each trade is smaller. 16 of 30middle test +0.5% 13 of 30middle test 0.0% 4 2
Only after an uptrend (above the 200 EMA) Only sell when the candle that closes below the neckline is still above the 200 EMA, a moving average of the last 200 candles that gives more weight to recent candles. Then the pattern ends an uptrend, as textbooks describe it. 12 of 30middle test −0.4% 9 of 30middle test −0.2% 0 0
With a take-profit at half the measured moveBest on 2007–2019 The take-profit is half the measured move: half as far below the neckline as the head is above it. The entry and the stop-loss stay the same. 19 of 30middle test +0.8% 15 of 30middle test +0.1% 5 1

The take-profit at half the measured move made money in the most tests in 2007–2019, the years we used to pick the best change. It made money in 19 of 30 tests, compared with 14 with the standard rules. In 2020–2025, the years we kept for the check, it made money in 15 of 30 tests, compared with 12. It made money in both periods on 5 of the 10 tests on 1-hour charts, compared with 4: GBP/USD, USD/JPY, USD/CHF, EUR/JPY and gold. GBP/USD on the 1-hour chart passed all four checks. But trade by trade, the gain was small. From 2007 to 2025, it made +0.005R per trade, compared with −0.002R, and in 2020–2025 it still lost 0.023R per trade (see 'Trade by trade' above). The stop-loss at the head made money in 16 of 30 tests in 2007–2019 and 13 in 2020–2025. It passed all four checks on 2 tests: GBP/USD and gold on 1-hour charts. Waiting for a retest made money in 17 of 30 tests in 2007–2019, but in only 10 in 2020–2025. Trading only after an uptrend made money in 12 of 30 tests in 2007–2019 and 9 in 2020–2025.

Passed all four checks with a take-profit at half the measured move

  • GBP/USD, 1-hour

Questions

Questions traders ask

Is the head and shoulders pattern reliable?

No. In our backtest, the head and shoulders top broke even after trading costs. We traded it on 8 currency pairs, gold and silver, on 1-hour, 4-hour and daily charts, from 2007 to 2025. 1R is the distance from the entry to the stop-loss, and every trade was sized so that losing 1R cost 1% of the account. The stop-loss was at the right shoulder. The take-profit was the measured move: as far below the neckline as the head is above it. The 2,166 trades lost 0.002R per trade on average, almost exactly zero, and 33.8% of them reached the take-profit. On 1-hour charts, GBP/USD, USD/CHF, EUR/JPY and gold made money in both 2007–2019 and 2020–2025. But with the 10 markets added together, the 1-hour trades lost money in 2020–2025.

Where do you put the stop-loss on a head and shoulders?

Traders usually put it at the right shoulder or at the head. In our backtest from 2007 to 2025, the choice changed how often the trades won, but not the result. 1R is the distance from the entry to the stop-loss, and every trade was sized so that losing 1R cost 1% of the account. The take-profit was the measured move: as far below the neckline as the head is above it. With the stop-loss at the right shoulder's high, 33.8% of the trades reached the take-profit, and the average trade lost 0.002R. With the stop-loss at the head's high, 51.3% reached it, and the average trade made +0.007R. The stop-loss at the head is further away, so with the same 1% risk each trade is smaller, and a win makes less. With either stop-loss, 4 markets made money on 1-hour charts in both 2007–2019 and 2020–2025: GBP/USD, USD/CHF, EUR/JPY and gold.

How often does a head and shoulders reach its target?

In our backtest, about 1 time in 3. The usual target is the measured move: as far below the neckline as the head is above it. We followed price after 2,279 neckline breaks on 10 markets from 2007 to 2025. Price fell the full measured move after 34.6% of them, before it went back above the right shoulder. It fell half of the measured move after 53.5%, and twice the measured move after 20.6%. With the take-profit at half the measured move, 52.2% of the trades reached it. But each win made less, so the average trade stayed close to zero: +0.005R per trade. 1R is the distance from the entry to the stop-loss, and every trade was sized so that losing 1R cost 1% of the account.

Should you wait for the neckline retest?

Not in our backtest. A retest is when price comes back up to the neckline after the break. After the candle that closed below the neckline, we placed a limit order (an order that waits at a set price) at the neckline's price for up to 10 candles. 82.6% of the orders filled. 1R is the distance from the entry to the stop-loss, and every trade was sized so that losing 1R cost 1% of the account. The average trade made +0.034R, compared with −0.002R when we sold at the next candle's open. But all of that gain came from 263 trades where price went less than one spread above the order's price. The spread is the gap between the buy price and the sell price. A broker may not fill a limit order when price only touches it. Without those trades, the retest lost 0.018R per trade. In 2020–2025, it lost 0.037R per trade, about the same as selling at the next candle's open (0.040R).

Keep exploring

Related strategies we tested

Chart patterns 7 well-known chart patterns, backtested and ranked Made money in 7 of 30 tests, 2 of them in both periods. Best: S&P 500, 4-hour, +49%
The strategy code we ran

This is the exact code from the BacktestingMax strategy engine. Paste it into the strategy editor in the app to run it on any market.

class HeadAndShoulders(Strategy):
    """The head and shoulders top, found from swing points with ATR tolerances, sold on the
    neckline break, plus the changes traders argue about.
    Swing points: a swing high is a candle whose high is higher than the highs of the 5 candles
    before it and the 5 candles after it (a tie doesn't count). A swing low is the mirror image.
    A swing is known 5 candles after it, when those candles have closed. Highs and lows take
    turns: if two swing highs come without a swing low between them, only the higher one counts
    (two lows in a row: only the lower one).
    The pattern: the last four swings known are a swing high (the left shoulder), a swing low
    (the first trough), a swing high (the head) and a swing low (the second trough). The right
    shoulder is the highest high since the second trough. The neckline is the straight line
    through the two troughs. ATR is ATR(14), the average candle range over the last 14 candles,
    on the candle that closes below the neckline. It is a head and shoulders when:
      the head is at least 1 ATR above the left shoulder and at least 1 ATR above the right one,
      the two shoulders are within 1 ATR of each other,
      both shoulders are above the neckline.
    Entry: when a candle closes below the neckline, sell short at the next candle's open. Only
    the first close below the neckline counts: if a candle had already closed below it (from the
    first trough on), the pattern is skipped. The pattern is dropped when the next swing low is
    known. Stop-loss: the right shoulder's high. Take-profit: the measured move, the head's height
    above the neckline, counted down from the neckline's price on the breakout candle. Size every
    trade to lose 1% of the account at the stop-loss. One trade at a time: a pattern that breaks
    out while a trade is open is skipped.
    Skipped candles: a candle that opens on a Friday at 17:00 New York time or later (a few
    minutes of prices after the weekly close make a tiny extra candle in some years), and a candle
    whose high equals its low (a market holiday in the price data). The strategy ignores them:
    they are never swing points or breakout candles, and they are left out of the ATR and the
    EMA, which is why both are worked out here. On a market that trades at the weekend, remove
    the Friday skip.
    The changes, one at a time (off by default):
      retest    = 1   wait for price to come back up to the neckline: after the breakout close,
                      a sell limit order at the neckline's price on the breakout candle. It
                      waits up to 10 candles and is cancelled if price reaches the take-profit
                      first
      stop_head = 1   the stop-loss goes at the head's high instead of the right shoulder's
      trend     = 1   only sell when the breakout candle closes above the 200 EMA: the pattern
                      ends an uptrend, as the textbooks describe it
      trend     = -1  only sell when the breakout candle closes below the 200 EMA: the pattern
                      forms in a downtrend, with the longer trend
      target_part = 0.5  take profit at half the measured move instead of all of it
    """
    params = {"swing_bars": Param(type=int, default=5, min=2, max=20),
              "atr_period": Param(type=int, default=14, min=2, max=100),
              "head_atr": Param(type=float, default=1.0, min=0.0, max=10.0),
              "shoulder_atr": Param(type=float, default=1.0, min=0.0, max=10.0),
              "retest": Param(type=int, default=0, min=0, max=1),
              "retest_bars": Param(type=int, default=10, min=1, max=100),
              "stop_head": Param(type=int, default=0, min=0, max=1),
              "trend": Param(type=int, default=0, min=-1, max=1),
              "ema_period": Param(type=int, default=200, min=2, max=1000),
              "target_part": Param(type=float, default=1.0, min=0.1, max=5.0)}
    lookback = 2
    def init(self, ctx):
        self.p = ctx.params
        self.ny = ctx.clock("America/New_York")
        self.k = -1                 # number of the newest candle the strategy uses
        self.hi = []                # highs, lows and closes of those candles
        self.lo = []
        self.cl = []
        self.swings = []            # [kind, price, k]: kind 1 = swing high, -1 = swing low
        self.pattern = None         # the four swings waiting for a neckline break
        self.prev_close = None
        self.atr = None             # Wilder's ATR, as the built-in one
        self.atr_sum = 0.0
        self.atr_n = 0
        self.ema = None             # the EMA of the closes
        self.ema_sum = 0.0
        self.ema_n = 0
        self.order = None           # retest: the resting sell limit order
        self.order_k = None
        self.order_target = None
    # ---- candles, ATR, EMA, swings ---------------------------------------------------------
    def update_averages(self, high, low, close):
        p = self.p
        tr = high - low if self.prev_close is None else max(
            high - low, abs(high - self.prev_close), abs(low - self.prev_close))
        self.prev_close = close
        n = p.atr_period
        self.atr_n += 1
        if self.atr_n < n:
            self.atr_sum += tr
        elif self.atr_n == n:
            self.atr = (self.atr_sum + tr) / n
        else:
            self.atr += (tr - self.atr) / n
        m = p.ema_period
        self.ema_n += 1
        if self.ema_n < m:
            self.ema_sum += close
        elif self.ema_n == m:
            self.ema = (self.ema_sum + close) / m
        else:
            self.ema += (close - self.ema) * 2.0 / (m + 1)
    def add_swing(self, kind, price, k):
        """Add a swing point. Returns True when the newest swing low changed."""
        s = self.swings
        if s and s[-1][0] == kind:
            if (kind == 1 and price > s[-1][1]) or (kind == -1 and price < s[-1][1]):
                s[-1] = [kind, price, k]
                return kind == -1
            return False
        s.append([kind, price, k])
        del s[:-12]
        return kind == -1
    def new_pattern(self, k):
        """The newest swing is a low: the last four swings are the pattern's left side."""
        self.pattern = None
        s = self.swings
        if len(s) < 4 or s[-1][0] != -1:
            return
        (_, h1, k1), (_, l1, k2), (_, h2, k3), (_, l2, k4) = s[-4:]
        slope = (l2 - l1) / (k4 - k2)
        # Skip it if a candle already closed below the neckline, from the first trough on.
        for j in range(k2, k):
            if self.cl[j] < l1 + slope * (j - k2):
                return
        rs_k = k4 + 1  # the right shoulder: the highest high after the second trough
        for j in range(k4 + 2, k + 1):
            if self.hi[j] > self.hi[rs_k]:
                rs_k = j
        self.pattern = {"h1": h1, "k1": k1, "l1": l1, "k2": k2, "h2": h2, "k3": k3, "l2": l2, "k4": k4,
                        "slope": slope, "rs": self.hi[rs_k], "rs_k": rs_k, "found_k": k}
    @staticmethod
    def neck(pat, j):
        return pat["l1"] + pat["slope"] * (j - pat["k2"])
    def breakout(self, pat, k, close):
        """The neckline break on this candle, if the shape is a head and shoulders, else None."""
        a = self.atr
        p = self.p
        h1, h2, rs = pat["h1"], pat["h2"], pat["rs"]
        ok = (h2 - h1 >= p.head_atr * a and h2 - rs >= p.head_atr * a
              and abs(h1 - rs) <= p.shoulder_atr * a
              and h1 > self.neck(pat, pat["k1"]) and rs > self.neck(pat, pat["rs_k"]))
        if not ok:
            return None
        level = self.neck(pat, k)
        height = h2 - self.neck(pat, pat["k3"])
        sig = dict(pat)
        sig.update({"level": level, "target": level - p.target_part * height, "height": height, "atr": a,
                    "ema": self.ema, "close": close, "k": k})
        return sig
    def step(self, high, low, close):
        """Add one candle. Returns the head and shoulders that broke out on its close, or None."""
        self.k += 1
        k = self.k
        self.hi.append(high)
        self.lo.append(low)
        self.cl.append(close)
        n = self.p.swing_bars
        c = k - n
        if c - n >= 0:
            win = range(c - n, k + 1)
            top = all(self.hi[c] > self.hi[j] for j in win if j != c)
            bottom = all(self.lo[c] < self.lo[j] for j in win if j != c)
            changed = False
            if top and bottom:  # an outside candle: keep the side that takes turns with the last swing
                last = self.swings[-1][0] if self.swings else -1
                changed = self.add_swing(-last, self.hi[c] if last == -1 else self.lo[c], c)
            elif top:
                changed = self.add_swing(1, self.hi[c], c)
            elif bottom:
                changed = self.add_swing(-1, self.lo[c], c)
            if changed:
                self.new_pattern(k)
        pat = self.pattern
        if pat is None or self.atr is None:
            return None
        if k > pat["k4"] and high > pat["rs"]:
            pat["rs"], pat["rs_k"] = high, k
        if close >= self.neck(pat, k):
            return None
        self.pattern = None  # only the first close below the neckline counts
        return self.breakout(pat, k, close)
    # ---- trading ---------------------------------------------------------------------------
    def on_bar(self, ctx):
        # A tiny candle after the Friday close, or a candle with no price movement: ignore it.
        if self.ny.weekday == 4 and self.ny.hour >= 17:
            return
        high, low, close = ctx.high[0], ctx.low[0], ctx.close[0]
        if not high > low:
            return
        p = ctx.params
        self.update_averages(high, low, close)
        sig = self.step(high, low, close)
        if self.order is not None:  # retest: a sell limit order is waiting at the neckline
            if self.order.state.value != "pending" or ctx.position is not None:
                self.order = None
            else:
                if low <= self.order_target or self.k - self.order_k >= p.retest_bars:
                    ctx.cancel_order(self.order.order_id)
                    self.order = None
                return
        if ctx.position is not None:
            return
        if not ctx.gate("head_and_shoulders_breakout", sig is not None):
            return
        if p.trend != 0:
            ema = sig["ema"]
            if not ctx.gate("trend_filter", ema is not None and (close - ema) * p.trend > 0):
                return
        self.enter(ctx, sig)
    def enter(self, ctx, sig):
        p = ctx.params
        stop = sig["h2"] if p.stop_head == 1 else sig["rs"]
        entry = sig["level"] if p.retest == 1 else sig["close"]
        target = sig["target"]
        # The stop-loss must be above the entry and the take-profit below it.
        if not ctx.gate("room_to_target", target < entry < stop):
            return
        size = ctx.size_by_risk_pct(0.01, stop=stop, entry=entry)
        if p.retest == 1:
            self.order = ctx.sell(size=size, limit=entry, sl=stop, tp=target, tag="head_and_shoulders")
            if self.order is not None:
                self.order_k, self.order_target = self.k, target
            return
        ctx.sell(size=size, sl=stop, tp=target, tag="head_and_shoulders")

Your turn

Test the head and shoulders pattern yourself

Change the settings, the market or the stop-loss and see the result in seconds. Ask the BacktestingMax AI: Backtest the head and shoulders top on gold, 1-hour chart, from 2007 to 2025: swing points with 5 candles on each side, head at least 1 ATR above both shoulders, shoulders within 1 ATR of each other, sell on a close below the neckline, stop-loss at the right shoulder, take profit at the measured move, risk 1% per trade.

Try it free in BacktestingMax

Free account. No credit card needed.

See every strategy we tested Browse strategies shared by traders

Backtest on historical data with trading costs, run by BacktestingMax. Past results do not guarantee future results, and nothing here is financial advice. Updated 2 November 2026.