TradingView candlestick patterns

On-neck and in-neck candlesticks: close-tolerance rules

An on-neck candlestick pattern is a bearish continuation setup: after a decline, a long bearish candle is followed by a smaller bullish candle whose close returns near the first low. In-neck uses the first close as its reference, with little recovery into the bearish body. Neither is a confirmed continuation or a piercing reversal merely because the second candle is green.

See the decision guide

Compare on-neck, in-neck and piercing

TradingView describes on-neck around the first low. The thinkorswim InNeck reference allows the second close to equal or slightly exceed the first close. Piercing requires a recovery above the first bearish body midpoint under TradingView's definition. These are different recovery depths, even when all three begin after falling prices.

  • A lower shadow on candle 1 separates its low from its close. Measuring both patterns against the low hides that difference.
  • For a bearish first candle, body midpoint M = (O1 + C1) / 2. Use the body midpoint, not (H1 + L1) / 2. A close exactly at M does not pass a strict above-midpoint piercing rule.
  • The custom rules below require O2 < L1 for both neck patterns. This is an explicit opening-gap requirement, stricter than definitions that only require O2 < C1.
FeatureOn-neckIn-neckPiercing
BackgroundDeclineDeclineDecline
First candleLong bearishLong bearishLarger-than-average bearish body
Second candleBullish reboundBullish reboundBullish rebound
Close referenceFirst lowFirst closeAbove first body midpoint
InterpretationContinuation candidateContinuation candidateReversal candidate

A reproducible rule set for close tolerance

Number the two candles 1 and 2, oldest first. O, H, L and C mean ordinary open, high, low and close. B1 = O1 - C1. The following settings are a research specification, not TradingView defaults, an exact thinkorswim implementation, or optimized trading parameters.

  • The strict C2 > C1 condition makes in-neck a shallow body penetration in this specification. The equal-close case allowed by thinkorswim is excluded unless it independently passes the on-neck test. Record this difference when comparing scanners.
  • Two ticks provide a small price-distance allowance; 2% of prior ATR adapts it to volatility. The 10% body cap prevents tolerance from expanding toward the midpoint. If the cap is below one tick, exact equality may be the only on-neck match and no strictly positive in-neck penetration may fit.
  • True range is max(H - L, abs(H - previous C), abs(L - previous C)). Freeze the reference ATR before candle 1 so the pattern itself cannot widen its own tolerance.
  • Use inclusive tolerance boundaries and strict gap, color and trend comparisons. Reject missing history, nonpositive tick, ATR or mean body, H < L, or open/close outside the high-low range. These rules add no separate shadow-length condition.
TestRule used on this page
Prior declineThe three closes immediately before candle 1 decrease strictly
Long first bodyC1 < O1 and B1 >= 1.5 × mean body of the preceding 20 bars
Second candleC2 > O2, O2 < L1, and C2 - O2 <= 0.5 × B1
Reference ATRA = 14-bar RMA of true range ending immediately before candle 1
ToleranceT = min(max(2 × tick, 0.02 × A), 0.10 × B1)
On-neck candidateabs(C2 - L1) <= T and C2 <= C1
In-neck candidateC1 < C2 <= C1 + T

Recalculate the accepted and rejected closes

All prices below are hypothetical. Candle 1 is (O, H, L, C) = (104, 104.50, 99.80, 100), so B1 = 4 and M = 102. Assume prior closes 107, 106, 105, a prior mean body of 2, ATR A = 2 and tick = 0.01. The long-body threshold is 3; tolerance T = min(max(0.02, 0.04), 0.40) = 0.04.

  • The on-neck interval is 99.76 through 99.84. A close at 99.76 passes; 99.75 fails. The in-neck interval is strictly above 100 through 100.04. Prices between these bands need no neck label.
  • With the same first candle but A = 0.50, T becomes 0.02, so 99.84 fails and 99.82 passes. With A = 30, the uncapped value is 0.60 but the body cap keeps T at 0.40.
  • If C1 equals L1, the reference levels coincide. The C2 <= C1 versus C2 > C1 split prevents duplicate labels. For tick-aligned data, compare integer tick distances with T / tick to avoid binary floating-point errors at equality.
CaseSecond candle (O, H, L, C)Decision
At the first low(99.50, 99.90, 99.40, 99.80)On-neck: distance 0; bullish body 0.30
Upper tolerance edge(99.50, 99.90, 99.40, 99.84)On-neck: distance 0.04, included
One tick beyond(99.50, 99.90, 99.40, 99.85)Neither: 0.05 above L1 but still below C1
Equal to the first close(99.50, 100.10, 99.40, 100)Neither under this strict variant: not above C1 and too far from L1
Shallow body penetration(99.50, 100.10, 99.40, 100.04)In-neck: penetration 0.04 / 4 = 1%
Beyond in-neck tolerance(99.50, 100.10, 99.40, 100.05)Neither: penetration 0.05 exceeds T
No opening gap(99.80, 100.10, 99.70, 100.04)Reject: O2 equals L1
Midpoint recovery(99.50, 102.20, 99.40, 102)Neither neck pattern; equality also fails strict piercing midpoint test
Above midpoint(99.50, 102.20, 99.40, 102.01)Fails neck rules; passes the piercing midpoint and gap comparisons

Confirm continuation without rewriting the candidate

Use a separate, declared confirmation rule. This example waits for the next three completed candles: a close below L2 confirms continuation; a close above M invalidates the pending hypothesis. If neither happens, it expires after the third close. This window and midpoint invalidation are research choices, not part of the two-candle name.

  • Each row is an independent hypothetical outcome. A close at 102 remains pending under the strict invalidation rule. Stop monitoring a pending candidate after its first confirmation, invalidation or expiry.
  • A bullish second candle alone does not establish a reversal. A downward confirmation does not establish a profitable short trade: entry timing, fills, costs, stops and exits still require separate rules.
  • Use completed ordinary candles. Session choices, corporate-action adjustments and synthetic chart prices can change gaps and boundaries. Keep those chart settings with the event record.
Later event for L2 = 99.40 and M = 102Recorded outcome
Low reaches 99.30 but close is 99.50Still pending: a wick is not a confirming close
Close equals 99.40Still pending: strict below-low test fails
Close reaches 99.39 within three barsContinuation confirmed at that close
Close reaches 102.01 before confirmationPending candidate invalidated
Three closes remain between 99.40 and 102, inclusiveExpired without confirmation
Confirmation occurs, then price later closes at 102.01Keep the confirmation event and record later failure separately

Turn the specification into a TradingView review workflow

Give Pine Script AI Coding Agent the formula table, both close bands and the confirmation window to draft a detector. Request separate candidate, confirmed, invalidated and expired outputs. Check the generated conditions and run the boundary cases before using its alerts or adding strategy orders.

  • Record symbol, timeframe, session, candle timestamps, all eight OHLC prices, tick, prior ATR and prior mean body. Ask for completed-bar evaluation and a frozen tolerance for each candidate.
  • Use AI Chart Analysis with screenshots of a match and a rejected near miss to review visible trend and candle context. Keep numeric OHLC values beside the image; a screenshot cannot certify a one-tick difference or supply off-screen reference history.
  • Review generated source and request syntax validation. Then compare plotted events against the same numeric cases and inspect historical chart matches. Compilation alone does not prove the detection rules or a trading advantage.
Where Pineify fits

Pine Script AI Coding Agent

Draft a detector from explicit gap, tick/ATR tolerance and confirmation rules. Review the generated source against accepted and rejected OHLC examples.

Also useful: AI Chart Analysis. Upload chart screenshots to review visible candle context. Verify exact low, close and tolerance boundaries against numeric price data.

Draft my neck-pattern detector

Frequently asked questions

Educational information, not investment advice. Prices, thresholds and confirmation rules are hypothetical research examples. Pattern labels, generated code and image interpretation do not establish predictive accuracy or profitability. Trading can lose money.

Sources and verification

Published by Pineify. Pineify is an independent product and is not affiliated with TradingView. Sources support the technical explanations; examples do not establish trading performance.