Home › Guides › Head and Shoulders Pattern

WHY BOTS FAILFREENO ACCOUNTAUTOMATED TRADE BOTSHead and ShouldersPatternThe arithmetic of how bots failEDUCATION ONLY | NO SIGNALSEXAMPLE NUMBERS ARE LABELLEDAUTOMATED TRADE BOTSautomatedtradebots.com
A free page on head and shoulders pattern. Education only, with example numbers labelled.
WHY BOTS FAIL

Head and Shoulders Pattern

Short answer

The head and shoulders pattern is three swing highs in a row, where the middle one (the head) is higher than the two outer ones (the shoulders). A line through the two dips between them is the neckline.

Three peaks, the middle one highest, and a line under the two dips. The arithmetic of the target is simple. Deciding what counts as the pattern is the hard part.

The page explains the idea in plain words, works through the arithmetic with a table, and shows how it hits grid, martingale and DCA bots, then tells you what to check before you run one.

  • A worked example with real arithmetic
  • How it hits grid, martingale and DCA bots
  • How to check for it before you run a bot
  • No advice, no signals, no profit promises

Last reviewed 28 October 2026. Education only, not advice.

Free, no account Runs in your browser Worked numbers shown Not advice Examples labelled

Ready to go further

Next: size a trade before testing a rule

Whatever pattern a bot trades, the loss on a failed trade is set by position size. The calculator works it out from the stop distance.

Reading time8 minutes
Worked exampleExact arithmetic
Tools linked1 on this page
Reviewed28 Oct 2026

What is included

  • What it is, in plain words
  • The formula or mechanism, with exact arithmetic
  • How it hits grid, martingale and DCA bots
  • A check you can run before you switch a bot on

Who it is for

  • People who run or plan to run a trading bot
  • Anyone reading a backtest or a bot sales page
  • Readers who want the numbers, not the pitch
  • Not advice, and not a signal service
Made-up head and shoulders with its neckline100110181624left shoulderheadright shoulderBar numberMade-up prices. Dashed line: neckline through the two troughs. Calculated by us on 31 Oct 2026, exact.
The picture for this page. Example numbers are made up unless the page says they were calculated.

Key facts

  • The head and shoulders pattern is three swing highs in a row, where the middle one (the head) is higher than the two outer ones (the shoulders). A line through the two dips between them is the neckline.
  • The inverse head and shoulders is the same shape upside down: three swing lows, the middle one lowest, with a neckline across the two rallies between them.
  • The usual measured-move rule takes the height from the head to the neckline and projects it from the break. In the made-up example below that height is 11.00 points and the target is 96.75 (calculated by us on 31 Oct 2026, exact).
  • Two people can draw different necklines on the same chart. The pattern is a judgement, so a rule written from it is only as steady as its definition.
  • This page does not say how often the pattern works. That is a number to measure on your own data, with costs.

What the pattern is

Price moves in swings: a run up to a high, a pull back to a low, another run. A swing high is a bar whose high is above the bars on either side. A head and shoulders pattern is a sequence of swing highs that looks like a person seen from behind: a left shoulder, a higher head in the middle, and a right shoulder that is lower than the head.

Between the peaks are two dips, the troughs. Draw a line through them and extend it to the right. That is the neckline. It can be flat or slope up or down. In the usual telling, a close below the neckline is the break that completes the pattern. Until it happens, the shape is only a shape.

The story told about it is that each rally got a little weaker, since the right shoulder failed to reach the head. That is a description of what the chart looks like. It is not a rule of how markets behave, and nothing on this page says the story is true more often than not.

The inverse pattern

The inverse head and shoulders flips everything over. There are three swing lows. The middle one, the head, is the lowest, and the two outer lows, the shoulders, are higher. The neckline is drawn through the two rallies between them, and a close above it is the break. The measured-move rule is the mirror image: the height from the head up to the neckline is projected upward from the break.

Nothing else changes. The same questions apply: how big must the difference between the head and the shoulders be, how level must the shoulders be, and which bar counts as the break?

The neckline and the measured-move rule

The common measured-move rule has three steps. Measure the height from the top of the head down to the neckline, taken at the head. Find the price on the neckline where the break happened. Subtract the height from that price to get a target. For the inverse pattern, add it instead.

target = neckline at the break - (head - neckline at the head)

It is a rule of thumb for where a move could reach, not a forecast, and price can stop short, run past it or never get near it. Many people also mark the top of the right shoulder as the point where the shape has failed, since a close back above it would break the story. Where a stop goes, and whether to use one at all, is a choice for the person writing the rules. See stop-loss order and risk-reward ratio.

A worked example with made-up numbers

Take a made-up chart of 27 bars. The left shoulder peaks at 110.00 on bar 5, the head at 116.00 on bar 12, and the right shoulder at 111.00 on bar 20. The troughs are 104.00 on bar 8 and 106.00 on bar 16. Because the second trough is higher, the neckline slopes up by 0.25 points a bar. The first close below the line is on bar 23, at 107.00. Every figure here is made up.

PointBarPriceNote
Left shoulder (peak)5110.00First swing high
Left trough8104.00First neckline point
Head (peak)12116.00Highest peak
Right trough16106.00Second neckline point
Right shoulder (peak)20111.00Lower than the head
Neckline at the head12105.00Line between the troughs
Head height-11.00116.00 minus 105.00
Neckline at the break23107.75The line has sloped up
Break: first close below23107.00Closes under the line
Measured target-96.75107.75 minus 11.00

The neckline at the head is 105.00, so the head stands 11.00 points above it. By bar 23 the sloping line has risen to 107.75, and the close of 107.00 is below it. The target is 107.75 minus 11.00, which is 96.75. From the break close that is 10.25 points. The right shoulder is 4.00 points above the break close, so the distance to the target is 2.6 times the distance to the shoulder. All of it was calculated by us on 31 Oct 2026, exact. Costs such as spread and slippage are left out to keep the count clear, and they would reduce any real result.

If the neckline had been drawn flat at 105.00 instead, the height would be 11.00 and the target 94.00. Same chart, same head, a different answer from a different line.

Made-up example: head height, distance to target, distance to shoulder11.00Head to necklinepoints10.25Break to targetpoints4.00Break to shoulderpointsMade-up numbers from the table on this page. Calculated by us on 31 Oct 2026, exact.
The three distances from the table, in points. Made-up numbers.

Why drawing it is subjective

Look at the example again. Which bar is the left shoulder? Why is bar 8 a trough and not bar 10? Does the neckline touch the lows exactly, or pass through the lowest closes? There is more than one right-looking answer to each.

  • Which points count as swings. A swing high can be defined over 2 bars either side, or 5, or 20. A different setting finds different peaks on the same data.
  • How level the shoulders must be. In the example the shoulders are 110.00 and 111.00, a gap of 1.00. Is that close enough? A larger gap would still look like a pattern to some people and not to others.
  • How the neckline is drawn. Through wicks or through closes. Through the troughs, or the lowest point between them. In the example, measuring from the first trough alone gives a head height of 12.00 and from the second alone 10.00, against 11.00 at the sloping line.
  • What counts as the break. A touch, a close, or a close and a retest. This is the same question raised on false breakout, and the answer changes the count of trades.
  • How long it may take. The same shape over 20 bars and over 200 bars is a different pattern on a different time frame.

Hindsight makes it worse. On a finished chart the head is obvious. At bar 16 the same chart is only a dip after a high. A person who draws patterns after the fact, with the whole chart in view, is using information that was not available at the time. That is look-ahead bias, and it is why pattern charts in articles look so clean.

Why bots struggle to code it

A bot needs a rule that gives the same answer every time it is run on the same data. To code this pattern, every choice in the list above has to become a number: the swing length, the shoulder tolerance, the neckline method, the break rule, the time limit. That has three consequences.

  • It finds the peaks late. A swing high defined over 5 bars either side is only confirmed 5 bars after it happens. The right shoulder is not known until after it has formed, and the break may come soon after. A test that marks the peak on the bar it happened has quietly looked ahead.
  • It has many settings. With five or six numbers to choose, it is easy to find a set that fits a past sample well. That is overfitting, and the result tells you about the sample, not the pattern.
  • It finds few examples. A strict definition matches few chart segments. A loose one matches many that no person would call the pattern. Either way the count of trades may be too small to say much. See expectancy for how results are averaged.

Some people instead train a model to spot shapes. That moves the judgement into the training data, where it is harder to see, and it still needs the same out-of-sample testing. See how to backtest.

How it fits with other tools

A pattern rule rarely stands alone. People pair it with RSI to look for weaker momentum at the right shoulder, with VWAP or Bollinger Bands for context, or with an EMA crossover as a trend filter. Each addition is another setting to test. A neckline break is also a form of breakout trading, so it inherits the same trade-off between entering early and entering late.

How to check a rule built on it

  • Write the definition down before testing: swing length, shoulder tolerance, neckline method, break rule, time limit.
  • Mark each swing only when it is confirmed, not on the bar it occurred.
  • Count every match in the data, including the ones that failed, and record the result of each after costs.
  • Test the inverse pattern separately. Do not assume it behaves like a mirror image.
  • Keep a final stretch of data untouched, and work out the loss on a failed trade with a tool such as the position size calculator.

What this does not tell you

It does not say how often a head and shoulders pattern is followed by a fall, whether the target is reached, or whether any rule built on it makes money. The example is one made-up chart. Real charts are messier, and a real count needs many matches, real costs and data the rule has not seen. This page is education only.

FAQ

Frequently Asked Questions

What is the head and shoulders pattern?

Three swing highs where the middle one is the highest, with a neckline through the two dips between them. A close below the neckline is usually treated as the break that completes it.

What is an inverse head and shoulders?

The same shape upside down: three swing lows with the middle one lowest, and a neckline across the two rallies. A close above the neckline is the break, and the target is projected upward.

How do you work out the target?

Measure the height from the head to the neckline, then subtract it from the neckline price at the break. It is a rule of thumb, and price may stop short or run past it.

Why is the pattern hard to code in a bot?

Every part needs a number: swing length, shoulder tolerance, neckline method and break rule. Swing highs are confirmed late, and many settings invite overfitting.

Does the pattern always work?

No, and this page makes no claim about how often it does. Whether it works is a question for a test on your own data with costs included.

Are the numbers on this page real?

Example numbers are made up to show how the maths works, and the page says so. A figure only counts as exact when the page says it was calculated on a stated date. Nothing you enter in a calculator leaves your browser.

Can I use this to decide whether to run a bot?

It can show whether a bot's numbers hold together and how much an account can lose. It cannot say what the market will do, and it is not advice. Use it to ask better questions, then read the terms of your own broker or exchange.

Is this financial advice?

No. It is general education. The prices are made up and it does not consider your situation or give any signal.

Know the Risk Before You Run It

Free calculators and guides, added every week. Leave your details and we will email you when new ones go up.

Trading carries a risk of loss