TL;DR. A head and shoulders is three swings with the middle one the extreme: a left shoulder, a deeper head, and a right shoulder at about the left one's price, with a neckline drawn through the two highs (or lows) between them. The Head and Shoulders node finds the inverse pattern at a low, which breaks up, and the top at a high, which breaks down. It fires once on the bar that closes through the neckline and hands you the neckline, a measured-move target and a stop. One Sensitivity setting decides how strict the shape must be.
What it measures
- A reversal. At a low, price makes a low, a lower low, then a higher low that fails to reach the head. A close above the neckline says the sellers have lost the swing.
- Both directions in one node. The inverse head and shoulders breaks up; the head and shoulders top is the same shape upside down and breaks down. The node's breakout reads +1 for the inverse pattern and -1 for the top.
- Once per pattern. The breakout fires on one bar and the pattern ends. Another breakout needs a new right shoulder.
Formula
Inputs in AlgoLift
| Setting | Default | Range | Notes |
|---|---|---|---|
| Sensitivity | 5 | 1 to 10 | How strict the shape is. 1 finds only the cleanest patterns, 10 the loosest; 5 is the textbook shape. Every setting below moves with it. |
| Longest pattern | 80 | 10 to 500 bars | The most bars from the left shoulder to the breakout. |
| Target (% of height) | 100 | 10 to 500 | The target's distance past the neckline, in percent of the head's distance from it. 100 is the classic measured move. |
| Settings | From Sensitivity | From Sensitivity, Custom | Custom unlocks the five settings below and reads them as you set them. |
| Swings of | 4 bars each side | 1 to 50 | Swing strength. Step 1: 5, steps 6 to 10: 3. |
| Head at least | 0.75 ATR deeper | 0 to 20 | How far the head must reach beyond both shoulders. Step 1: 1.5, step 10: 0.2. |
| Shoulders within | 1.0 ATR | 0 to 20 | How far apart the shoulders may be. Step 1: 0.5, step 10: 2.0. |
| Neckline peaks within | 1.5 ATR | 0 to 20 | How far apart the neckline's two peaks may be. Step 1: 0.5, step 10: 4.0. |
| Breaks by | 0.05 ATR | 0 to 5 | How far past the neckline a close must be. Step 1: 0.15, steps 7 to 10: 0. |
Outputs in AlgoLift
| Handle | Type | Plotted | Notes |
|---|---|---|---|
| Breakout | Numeric | Always | +1 on an inverse head and shoulders' breakout bar, -1 on a top's, 0 elsewhere. Wire it into a Comparison (greater than 0 for longs, less than 0 for shorts). |
| Inverse head and shoulders breakout, Head and shoulders top breakout | Numeric | On select | 1 on that side's breakout bar, else 0. |
| Stage | Numeric | On select | 0 none, 1 a head has formed, 2 armed (the right shoulder is confirmed and a close through the neckline would break out). Positive for the inverse pattern, negative for the top. |
| Breakout level | Numeric | Always | The armed pattern's neckline at the bar. |
| Pattern high, Pattern low | Numeric | On select | The pattern's range since the left shoulder. |
| Target, Stop | Numeric | On select | The last breakout's measured move and its right shoulder, held until the next breakout. |
| Bars forming | Numeric | On select | Bars since the left shoulder. |
How to read it
- Stage 2: the right shoulder is confirmed and the neckline is drawn. A close through it is the signal.
- Stage 1: a head has formed below the swing before it, and the node is waiting for a right shoulder.
- A neckline that disappears without a marker: a new swing formed, price closed back through the right shoulder, or the pattern ran longer than its limit.
- Few signals: raise Sensitivity one step at a time and watch the count. Each step loosens every rule together, so the shape stays coherent.
Best in, worst in
Best in markets that have trended for a while and start to make lower highs (for a top) or higher lows (for the inverse), where the neckline is a level other traders watch too.
Worst in tight ranges, where three similar swings appear constantly and the neckline is broken back and forth.
Three setups
1. Neckline break with a momentum check
Wire Breakout into a Comparison (greater than 0) and require the RSI above 50 into a long Entry. Mirror it with less than 0 and RSI below 50 for shorts.
2. Measured-move exits
Set a Bracket Order with its target at the node's Target and its stop at the node's Stop, so every trade's exits come from its own pattern.
3. Only patterns that formed quickly
Add a Comparison that Bars forming at the breakout is below 50, so slow, drawn-out patterns are skipped.
Common mistakes
- Expecting the signal at the right shoulder. The node waits for the shoulder to be confirmed (Swings of bars later) and then for a close through the neckline. Entering at the shoulder is a different, earlier trade.
- Loosening several rules at once. Move Sensitivity one step, not five separate settings. If you need one rule different, switch Settings to Custom and change only that one.
- Choosing Sensitivity on the backtest you report. Pick it on one window and check it on another (overfitting in trading).
The Head and Shoulders node finds three swings with the head the extreme, draws the neckline through the highs between them, and fires once when a close breaks it, in both directions. Sensitivity sets how strict the whole shape is with one number.