Identify the shoulders, head and neckline
Read the sequence from left to right: shoulder low, reaction high, head low, reaction high, shoulder low. The middle low must be below both shoulders. An inverted head and shoulders pattern describes the same formation; the usual reversal interpretation also requires a preceding decline. Three lows inside an existing uptrend need a different context assessment.
- Symmetry is a rule to define, not an instruction to search backward for a prettier formation. Specify both price tolerance and allowed spacing.
- Equal-depth lows are closer to a triple-bottom hypothesis. Two lows alone do not establish this five-point structure.
| Point | What to record | Reject or review when |
|---|
| Left shoulder | First selected low and its bar | A later review replaces it solely to make the shape fit |
| First neckline anchor | Reaction high between left shoulder and head | The high falls outside those two lows |
| Head | Middle low, below both shoulders | All three lows are effectively equal |
| Second neckline anchor | Reaction high between head and right shoulder | An unrelated later high is used to lower the breakout threshold |
| Right shoulder | Final selected low and its confirmation bar | Its price falls below the head |
Calculate a sloping neckline at the breakout bar
For a detector using linear prices and bar indices, let the neckline anchors be price P1 at bar b1 and price P2 at bar b2. Its value at bar t is N(t) = P1 + (P2 - P1) × (t - b1) / (b2 - b1). Require b2 > b1. Store these anchors when the candidate becomes eligible; later highs must not silently redraw the threshold for that candidate.
- A rising neckline increases the required breakout price with time. A falling neckline lowers it. A flat line keeps the same threshold.
- Use N(t) for the current comparison and N(t - 1) for the previous comparison. Comparing both closes with the current line value changes the crossing test.
- On a falling neckline, a crossover can occur partly because the threshold falls. If your hypothesis requires upward price movement too, add an explicit close-above-previous-close condition and test it separately.
- The formula uses arithmetic prices. A line interpolated in logarithmic price space is a different rule; do not mix the two in one test.
A reproducible example with unequal shoulders
These hypothetical prices illustrate a candidate, not an observed trade. Assume a preceding decline has already passed a separately defined trend filter. Select lows at bar 10 = 100, bar 20 = 94 and bar 30 = 101, with intervening highs at bar 15 = 110 and bar 25 = 108. The neckline falls by 0.2 price units per bar. At the head bar its value is 109, so head depth is 15.
- The tolerance denominator matters. Fifteen percent of head depth is different from fifteen percent of the stock price. Reject a zero or negative head depth before calculating the ratio.
- A more unequal right shoulder at 103 would fail this particular tolerance: its difference from 100 is 3, greater than 2.25. That is a rule rejection, not proof that price cannot rise.
- Allow a crossing on the confirmation bar, as in this example. If the crossing happened before that bar, do not backdate a signal; require a later fresh crossing or reject the candidate.
| Example rule | Calculation or condition | Result |
|---|
| Shoulder tolerance | Absolute shoulder difference ≤ 15% of head depth | 1 ≤ 2.25: accepted |
| Spacing | Each shoulder-to-head interval is 5 to 20 bars | Both intervals are 10 bars: accepted |
| Pivot confirmation | Three completed bars on each side of a selected extreme | The right shoulder at 30 is first usable at the close of 33 |
| Breakout | Previous close ≤ previous neckline; current close > current neckline | If close 32 = 106.5 and close 33 = 106.7, the line values are 106.6 and 106.4: accepted at 33 |
| Candidate expiry | No qualifying breakout in the first 20 bars starting at right-shoulder confirmation | Discard after that window; do not keep lowering an old neckline indefinitely |
Distinguish unfinished patterns, retests and failure
Use separate states so a completed shape is not confused with a completed trade. The following lifecycle extends the illustrative rules above. Its close-based failure rule is a custom choice, not a claim to reproduce every TradingView Auto Chart Patterns status.
- In the numerical example, N(35) is 106. A low of 105.9 and close of 106.3 on bar 35 would pass the stated retest rule. A later close at 100.8 would fail the saved right-shoulder threshold of 101.
- A close back below the neckline is an earlier warning than the chosen shoulder failure rule. You can test it as a separate exit, but changing between exits after seeing the outcome invalidates the comparison.
- A retest is not required by the basic pattern definition. Waiting for one changes entry timing and excludes breakouts that never return.
- A signal condition is not a fill price. Any strategy version must specify order timing, commissions, slippage and stop behavior independently.
| State or event | Illustrative decision | What it means |
|---|
| Unfinished | Right shoulder is unconfirmed, or no eligible neckline crossing exists | Monitor the candidate without a confirmed breakout label |
| Invalid before breakout | A completed bar has a low below the saved head, or the candidate expires | Reject before evaluating a breakout on that bar |
| Confirmed breakout | The crossing rule passes after all required pivots are known | Record one event at the current close |
| Optional retest | Within the next 10 bars, the low is within 0.2 of N(t) and the close is above N(t) | A second condition, evaluated after the breakout bar |
| Failed after confirmation | A later completed close is below the saved right-shoulder low | End this example setup; retain its original breakout in the history |
| No retest | The retest window ends without a qualifying touch | Skip a retest-based entry; the earlier breakout still occurred |
Check when the signal was actually knowable
The TradingView repainting documentation explains that pivot scripts can place a historical drawing on a bar only after subsequent bars identify the pivot. Keep the geometry attached to its original points, but put the signal marker on the bar where all conditions became available. A confirmed-bar rule also avoids treating a temporary intrabar crossing as a finished close.
- Write the swing-selection rule before testing: for example, retain the latest five alternating confirmed pivots, resolve consecutive same-side pivots by keeping the more extreme one before candidate creation, and then freeze the candidate.
- Define equal-price ties and minimum spacing. Two detectors can disagree without either containing a syntax error.
- Replay the right shoulder one bar at a time. In the example, bars 30, 31 and 32 cannot carry the confirmed breakout event.
- Record rejected candidates and failed breakouts as well as completed winners. Preserve old signal timestamps when a newer overlapping pattern appears.
- Compare the same fixed rules on a separate period. This page provides no measured win rate, preferred market or best timeframe.
Read TradingView pattern states before adapting them
The official TradingView Inverse Head And Shoulders documentation describes an In Progress mode that can show emerging patterns before the right shoulder is a confirmed pivot. It also distinguishes New Pattern from Pattern Formed alerts. Its documented Failed status concerns price moving below the right shoulder before the target is reached. These product-specific states are not interchangeable with the custom close-based lifecycle above.
- For a custom Pineify draft, provide the pivot window, tie rule, shoulder tolerance, fixed neckline anchors, breakout timing, expiry and failure conditions together.
- Ask for separate timestamps for geometric pivots and confirmed events, then review the generated script and request a syntax check. Compilation alone cannot establish that the detector follows your trading rules.