Why the Three Black Crows Pattern Matters in Pine Script
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.
Understanding the Three Black Crows Candlestick Pattern
A Three Black Crows pattern consists of three specific, consecutive bearish candles:
- First Candle (Bearish): A long bearish (red) candle, ideally closing near its low, indicating initial selling strength.
- 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.
- 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.
This sequence demonstrates a sustained and powerful surge in selling activity, overcoming previous buying pressure.
Three Black Crows Pattern
Three consecutive long red candles, each opening within the previous body and closing lower, with small upper shadows.
- 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.
Basic Three Black Crows Pattern Detection in Pine Script
Here's how to create a basic indicator to detect Three Black Crows patterns in Pine Script v5:
//@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!")
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.
1. Three Black Crows with Uptrend Reversal Confirmation (Using Moving Average)
//@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)
2. Three Black Crows with Volume Confirmation
//@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)
3. Three Black Crows with RSI Confirmation
//@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)
Optimizing Three Black Crows Pattern Performance
To maximize the effectiveness of Three Black Crows patterns in your Pine Script 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.
Common Three Black Crows Pattern Pitfalls to Avoid
- 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.
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 Pine Script 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.