Counterattack (CDLCOUNTERATTACK)
Summary
A two-candle pattern of two long, opposite-colored real bodies whose closing prices are (nearly) equal. Emits a bullish signal when the second candle is white and a bearish signal when it is black (a reversal signal, though its trend context is not checked).
Notes
- Does not verify the prior trend the reversal signal classically assumes.
- Bulkowski's testing found the bearish Counterattack/Meeting Lines does not reliably reverse at all — it acts as a bullish CONTINUATION 51% of the time — and the bullish version reverses only 56% of the time, both "near random" by his classification. (thepatternsite.com)
Inputs
inOpen— Open price of each barinHigh— High price of each barinLow— Low price of each barinClose— Close price of each bar
Outputs
outInteger— +100 when the second candle is white (bullish), -100 when it is black (bearish), 0 when no pattern
Output Values
| Value | Meaning |
|---|---|
| -100 | Bearish Counterattack — a strong rally is matched and stopped cold by an equally strong opposite close, a reversal warning at a top |
| 0 | No pattern |
| 100 | Bullish Counterattack — a strong decline is matched and stopped cold by an equally strong opposite close, a reversal warning at a bottom |
Properties
Numerical Stability: Start-Independent
| ☐ Overlap Input |
| ✅ Independent Y-Axis i |
| ✅ Candlestick i |
| ☐ Can Output NaN or ±Inf |
| ☐ Identity at Period 1 |
Implementation
TA-Lib Definition: cdlcounterattack.c · cdlcounterattack.yaml
| Native | File |
|---|---|
| C | ta_CDLCOUNTERATTACK.c |
| Rust | cdlcounterattack.rs |
| Java | Core_CDLCOUNTERATTACK.java |
TA-Lib is also available for Python, R and more using a wrapper.
Aliases
Counterattack, Counterattack Lines, Meeting Lines