Logo
OFFLINEPIXEL
/ pinescript-strategies / pine-script-three-black-crows

$ Pinescript: Three Black Crows Candlestick Pattern

Unlock powerful bearish trend reversal and continuation signals with this comprehensive guide to detecting and strategizing with Three Black Crows patterns in TradingView's Pinescript.

500+ Clients Helped
100% Satisfaction
Live Trading Ready
⚠️
Trading financial markets carries risk. All content (PineScript code, indicators, strategies) on this website is for educational purposes only. Past performance is not indicative of future results. By using any code or information from this site, you agree that you are solely responsible for your trading decisions. The author disclaims all liability for any losses incurred. To gain from experts experiences, You can always try our Invite Only Scripts
01

Why the Three Black Crows Pattern Matters in Pinescript

The Three Black Crows candlestick pattern is a strong three-candle bearish reversal or continuation pattern. It indicates a clear shift in market sentiment from buying to strong selling pressure. This pattern is characterized by three consecutive long bearish (red) candles that open within the body of the previous candle and close lower than the previous candle's close, ideally with small or no upper shadows. This demonstrates consistent bearish strength and makes Three Black Crows patterns invaluable for:

  • Identifying potential strong bearish trend reversals, especially after an uptrend.
  • Confirming the strength and continuation of an existing downtrend.
  • Generating high-conviction entry signals for short positions.
02

Understanding the Three Black Crows Candlestick Pattern

A Three Black Crows pattern consists of three specific, consecutive bearish candles:

  1. First Candle (Bearish): A long bearish (red) candle, ideally closing near its low, indicating initial selling strength.
  2. Second Candle (Bearish): A long bearish (red) candle that opens within the body of the first candle and closes lower than the first candle's close, ideally with little to no upper shadow.
  3. Third Candle (Bearish): Another long bearish (red) candle that opens within the body of the second candle and closes lower than the second candle's close, also ideally with little to no upper shadow.
03

Three Black Crows Pattern Illustration

Three Black Crows Pattern

Three consecutive long red candles, each opening within the previous body and closing lower, with small upper shadows.

04

Key Characteristics

Key Characteristics

Three Consecutive Bearish Candles: All three must be red.
Long Bodies: Each candle should have a significant body, showing strong selling pressure.
Lower Closes: Each candle's close must be lower than the previous candle's close.
Open within Previous Body: The open of the second candle should be within the real body of the first; the open of the third should be within the real body of the second.
Small/No Upper Shadows: Ideally, little to no upper shadow on each candle, indicating selling pressure throughout the period.
Context: Most significant when appearing after a clear uptrend or during a pullback in a downtrend.

05

Basic Three Black Crows Pattern Detection in Pinescript

pine-script@terminal
//@version=5
indicator("Three Black Crows Detector", overlay=true)

// User input for minimum body size (as a percentage of ATR)
minBodySize = input.float(0.4, title="Min Body Size (ATR multiple)", minval=0.1, maxval=2.0)
// User input for maximum upper shadow size (as a percentage of body)
maxUpperShadowRatio = input.float(0.2, title="Max Upper Shadow Ratio (of Body)", minval=0.01, maxval=0.5)

// Helper function to check if a candle is a strong bearish candle with small upper shadow
isStrongBearish(idx) =>
    body = open[idx] - close[idx]
    upperShadow = high[idx] - math.max(open[idx], close[idx])

    body > ta.atr(14)[idx] * minBodySize and // Body is significant
    close[idx] < open[idx] and // It's a bearish candle
    upperShadow < body * maxUpperShadowRatio // Small upper shadow

// Check individual candle properties
isC1StrongBearish = isStrongBearish(2)
isC2StrongBearish = isStrongBearish(1)
isC3StrongBearish = isStrongBearish(0) // Current bar

// Check opening conditions
// open[1] should be lower than open[2] but higher than close[2]
isC2OpensInC1Body = open[1] < open[2] and open[1] > close[2]
// open[0] should be lower than open[1] but higher than close[1]
isC3OpensInC2Body = open[0] < open[1] and open[0] > close[1] // open[0] is current `open`

// Check lower closes
isC2ClosesLowerThanC1 = close[1] < close[2]
isC3ClosesLowerThanC2 = close[0] < close[1] // close[0] is current `close`

// Combine all criteria for Three Black Crows
isThreeBlackCrows = isC1StrongBearish and isC2StrongBearish and isC3StrongBearish and \
                    isC2OpensInC1Body and isC3OpensInC2Body and \
                    isC2ClosesLowerThanC1 and isC3ClosesLowerThanC2

// Plot signal on the chart
plotshape(isThreeBlackCrows, title="Three Black Crows", location=location.abovebar, color=color.new(color.maroon, 0), style=shape.triangledown, size=size.normal)

// Alert condition (optional)
alertcondition(isThreeBlackCrows, title="Three Black Crows Detected", message="Three Black Crows Pattern Detected!")
$ ✓ Compiled successfully
06

Advanced Three Black Crows Strategies

Combining Three Black Crows patterns with other indicators and market context provides stronger, more reliable signals for potential bearish moves.

07

1. Three Black Crows with Uptrend Reversal Confirmation (Using Moving Average)

pine-script@terminal
//@version=5
strategy("Three Black Crows (Trend Reversal)", overlay=true)

// Input for Moving Average length (for trend detection)
maLength = input(50, "MA Length (for trend)")
ma = ta.ema(close, maLength)

// Three Black Crows Pattern Detection (from basic example - simplified for brevity)
isC1StrongBearish = close[2] < open[2] and (open[2] - close[2]) > ta.atr(14)[2] * 0.4
isC2StrongBearish = close[1] < open[1] and (open[1] - close[1]) > ta.atr(14)[1] * 0.4
isC3StrongBearish = close > open and (open - close) > ta.atr(14) * 0.4

isC2OpensInC1Body = open[1] < open[2] and open[1] > close[2]
isC3OpensInC2Body = open > open[1] and open < close[1] // open[0] is current `open`

isC2ClosesLowerThanC1 = close[1] < close[2]
isC3ClosesLowerThanC2 = close > close[1] // close[0] is current `close`

// Additional check for small upper shadows for robustness
isSmallUpperShadowC1 = (high[2] - math.max(open[2], close[2])) < (math.abs(open[2] - close[2]) * 0.2)
isSmallUpperShadowC2 = (high[1] - math.max(open[1], close[1])) < (math.abs(open[1] - close[1]) * 0.2)
isSmallUpperShadowC3 = (high - math.max(open, close)) < (math.abs(open - close) * 0.2) // Current bar's upper shadow

isThreeBlackCrows = isC1StrongBearish and isC2StrongBearish and isC3StrongBearish and \
                    isC2OpensInC1Body and isC3OpensInC2Body and \
                    isC2ClosesLowerThanC1 and isC3ClosesLowerThanC2 and \
                    isSmallUpperShadowC1 and isSmallUpperShadowC2 and isSmallUpperShadowC3

// Trend Confirmation: Pattern appears after a clear uptrend (price above MA)
isUptrend = close[3] > ma[3] and close[2] > ma[2] and close[1] > ma[1] // Check prior bars for uptrend context

// Strategy Logic with Trend Confirmation
shortSignal = isThreeBlackCrows and isUptrend

if (shortSignal)
    strategy.entry("Short", strategy.short)

// Plot MA
plot(ma, "Trend MA", color.blue)

// Plot confirmed signals
plotshape(shortSignal, title="Confirmed 3 Black Crows (Reversal)", location=location.abovebar, color=color.new(color.fuchsia, 0), style=shape.arrowdown, size=size.normal)
$ ✓ Compiled successfully
08

2. Three Black Crows with Volume Confirmation

pine-script@terminal
//@version=5
indicator("Three Black Crows with Volume Confirmation", overlay=true)

// Three Black Crows Pattern Detection (from basic example - simplified)
isC1StrongBearish = close[2] < open[2] and (open[2] - close[2]) > ta.atr(14)[2] * 0.4
isC2StrongBearish = close[1] < open[1] and (open[1] - close[1]) > ta.atr(14)[1] * 0.4
isC3StrongBearish = close < open and (open - close) > ta.atr(14) * 0.4

isC2OpensInC1Body = open[1] < open[2] and open[1] > close[2]
isC3OpensInC2Body = open < open[1] and open > close[1]

isC2ClosesLowerThanC1 = close[1] < close[2]
isC3ClosesLowerThanC2 = close < close[1]

isThreeBlackCrows = isC1StrongBearish and isC2StrongBearish and isC3StrongBearish and \
                    isC2OpensInC1Body and isC3OpensInC2Body and \
                    isC2ClosesLowerThanC1 and isC3ClosesLowerThanC2

// Volume Confirmation:
// Each bearish candle should have equal or increasing volume,
// and the third candle's volume should be significantly higher than average volume.
avgVolume = ta.sma(volume, 20) // 20-period Simple Moving Average of Volume
isVolumeConsistent = volume[2] <= volume[1] and volume[1] <= volume // Volume equal or increasing
isVolumeConfirmed = volume > avgVolume * 1.2 // Current volume is 1.2x average

// Combined signal
confirmedThreeBlackCrows = isThreeBlackCrows and isVolumeConsistent and isVolumeConfirmed

// Plot confirmed signals
barcolor(confirmedThreeBlackCrows ? color.new(color.purple, 60) : na)

plotshape(confirmedThreeBlackCrows, title="3 Black Crows (Vol Confirmed)", location=location.abovebar, color=color.new(color.red, 0), style=shape.labeldown, size=size.small, text="3BC Vol")

// Optional: Plot volume for visual check
plot(volume, title="Volume", color=color.gray, style=plot.style_columns)
plot(avgVolume, title="Avg Volume", color=color.orange, style=plot.style_line)
$ ✓ Compiled successfully
09

3. Three Black Crows with RSI Confirmation

pine-script@terminal
//@version=5
indicator("Three Black Crows with RSI Confirmation", overlay=true)

// RSI Inputs
rsiLength = input(14, "RSI Length")
overbought = input(70, "RSI Overbought Level")

// Calculate RSI
rsiValue = ta.rsi(close, rsiLength)

// Three Black Crows Pattern Detection (simplified)
isC1StrongBearish = close[2] < open[2] and (open[2] - close[2]) > ta.atr(14)[2] * 0.4
isC2StrongBearish = close[1] < open[1] and (open[1] - close[1]) > ta.atr(14)[1] * 0.4
isC3StrongBearish = close < open and (open - close) > ta.atr(14) * 0.4

isC2OpensInC1Body = open[1] < open[2] and open[1] > close[2]
isC3OpensInC2Body = open < open[1] and open > close[1]

isC2ClosesLowerThanC1 = close[1] < close[2]
isC3ClosesLowerThanC2 = close < close[1]

isThreeBlackCrows = isC1StrongBearish and isC2StrongBearish and isC3StrongBearish and \
                    isC2OpensInC1Body and isC3OpensInC2Body and \
                    isC2ClosesLowerThanC1 and isC3ClosesLowerThanC2

// RSI Confirmation: RSI falling from overbought territory or showing bearish divergence
rsiConfirmation = rsiValue < rsiValue[1] and rsiValue[1] < rsiValue[2] and rsiValue[2] >= overbought // RSI falling from overbought
// Or simpler: rsiValue <= overbought and rsiValue < rsiValue[1]

// Combined signal
signalThreeBlackCrows = isThreeBlackCrows and rsiConfirmation

// Plot signals
plotshape(signalThreeBlackCrows, title="3 Black Crows (RSI Confirmed)", location=location.abovebar, color=color.new(color.orange, 0), style=shape.arrowdown, size=size.normal)

// Plot RSI in a separate pane
plot(rsiValue, "RSI", color.blue, linewidth=2, display=display.pane)
hline(overbought, "Overbought", color.red)
$ ✓ Compiled successfully
10

Optimizing Three Black Crows Pattern Performance

To maximize the effectiveness of Three Black Crows patterns in your Pinescript strategies:

  • Context is King: This pattern is most powerful when it appears after a clear uptrend (signaling a reversal) or during a minor pullback within an established downtrend (signaling continuation). Avoid it in choppy or ranging markets.
  • Volume Confirmation: Look for increasing or consistently high volume accompanying the three bearish candles. Strong volume adds conviction to the selling pressure.
  • Candle Sizes: While all three should be "long," watch for diminishing candle sizes, which could indicate weakening momentum. Ideally, they maintain or increase in size slightly.
  • Small Shadows: Minimal upper shadows indicate that sellers held control throughout the session, with little rejection of lower prices.
  • Resistance Levels: When the pattern forms at a significant resistance level (e.g., a previous high, moving average, Fibonacci retracement), its reliability as a reversal signal increases.
  • Timeframe: Signals on higher timeframes (e.g., daily, weekly) generally carry more weight and are more reliable for sustained moves than those on lower timeframes.
11

Common Three Black Crows Pattern Pitfalls to Avoid

Warning: Not every sequence of three red candles constitutes a valid "Three Black Crows" pattern. Strict adherence to criteria and contextual analysis are essential.
  • Ignoring Body Size: If the bodies are too small, they don't indicate strong selling pressure. Ensure they are substantial relative to the average candle size.
  • Overlapping Bodies: If the second or third candle's open is above the previous candle's close (i.e., a gap down), it's a stronger signal, but the pattern allows for opens *within* the previous body. However, if the open is above the previous candle's high, it's not a Three Black Crows.
  • Large Upper Shadows: Significant upper shadows on any of the three candles can indicate underlying buying pressure, weakening the bearish signal.
  • Lack of Lower Closes: If any of the candles fail to close lower than the previous one, the bearish momentum is broken, and it's not a valid pattern.
  • Trading Against the Trend: Using this pattern as a reversal signal when the broader trend is strongly bullish can lead to false signals. Always confirm the context.
  • Over-reliance: Relying solely on this pattern without confirmation from other indicators or broader market analysis can lead to whipsaws or missed opportunities.
12

Conclusion

Conclusion

The Three Black Crows candlestick pattern is a powerful and visually clear signal for robust bearish price action. By understanding its precise three-candle formation, its contextual importance (especially after an uptrend), and integrating it with other technical confirmations like volume and momentum oscillators, you can leverage it effectively in your trading. Implementing Three Black Crows detection in Pinescript allows you to automate signal generation, combine it with complementary indicators for higher probability trades, and enhance your price action analysis to make more informed trading decisions on TradingView.

Enhance Your Trading

Get a high-performance Pinescript analysis tool for actionable market insights, designed for traders on the move.

This strategy runs in live mode on TradingView, helping you identify potential opportunities.

Get Pinescript Strategy