Counterattack Candlestick Pattern: Rules and Names
The counterattack candlestick pattern: two long opposite-coloured candles that close at the same price. Rules, three names, counts on EURUSD and GER40.
The counterattack candlestick pattern is two long candles of opposite colours where the second one closes at the same price as the first. The whole of the first candle's move is handed straight back, which is where the name comes from.
Both published specifications ask for an exact or near-exact match of two closing prices, and neither says how near "near" is. On our own EURUSD 15-minute bars, two long opposite-coloured candles closing at exactly the same tick happened 0 times in eight months. Loosen the match to 20 ticks and you get 215 candidates. The number you report is decided almost entirely by a tolerance you have to choose yourself.
What is a counterattack candlestick pattern?
Two long candles of opposite colours whose closing prices match. TA-Lib implements it as CDLCOUNTERATTACK and states the shape in one sentence: "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)".
thinkorswim states it as four recognition lines, and drops the word "nearly":
- The bearish version: "The first candle is long and bullish and continues the uptrend; The second candle is long and bearish and its Close price is equal to that of the first candle."
- The bullish version: "The first candle is long and bearish and continues the downtrend; The second candle is long and bullish and its Close price is equal to that of the first candle."
Most guides state the matching close in some form, so the condition itself is not in dispute. What they disagree about is how exact it has to be and what else is required. Two substitute something different:
- Motilal Oswal anchors the second candle's open instead of its close: it "should open at or very near the close of the first candle". Opening at the first candle's close is close to the opposite of the usual condition, which has the second candle opening away from it.
- Tradeorca's help entry publishes a midpoint rule: the second candle "should have a large body and close above the midpoint of the bearish candle". That is the piercing pattern's threshold, not a matching close. Its worked example then loosens it again, to a candle that "closes above the high of the previous bearish candle".
Is the counterattack pattern built into ChartLabs?
Yes. Open the Indicators menu and, in the Standard list, add Candlestick Patterns from the Patterns heading. It draws on the price pane and holds 61 pattern switches. Counterattack is one of them, in the two-candle group, and it is on when you add the indicator.
A match is marked CA on the second candle: below its low when that candle is white, above its high when it is black. The test is TA-Lib's, on TA-Lib's default thresholds, and the indicator does not let you change them.
Is it called counterattack lines or meeting lines?
All three names are in use, and TA-Lib lists them together. Its aliases line reads "Counterattack, Counterattack Lines, Meeting Lines".
thinkorswim files it as MeetingLines, in its bearish-and-bullish folder, and the word "counterattack" does not appear anywhere on that page. Search a scanner for "counterattack" and you will not find it there.
Motilal Oswal and Elearnmarkets both give "counterattack lines" as an alternative name in their own text.
What is the difference between a bullish and a bearish counterattack?
They are exact mirrors, and both halves exist in the specifications.
- Bullish: a long black candle in a decline, then a long white candle closing at the first one's close. The library emits +100.
- Bearish: a long white candle in a rally, then a long black candle closing at the first one's close. The library emits -100.
TA-Lib's output line for this one reads "+100 when the second candle is white (bullish), -100 when it is black (bearish), 0 when no pattern", so a single detector gives you both halves. Its notes add that Bulkowski's testing, published on thepatternsite.com, disputes the classical reversal reading for this pattern altogether.
How is it different from a piercing pattern, dark cloud cover or an engulfing pattern?
They are the same two candles. Only the depth of the second candle's close separates them, and the counterattack asks for the one depth that is hardest to hit.
The library's own See Also list points at two of them, CDLPIERCING and CDLDARKCLOUDCOVER. Angel One answers the question directly: "vs Piercing Line / Dark Cloud Cover: In those patterns, the second candle pierces deeply into the body of the first candle (usually retracing 50% or more). In a Counterattack pattern, the second candle does not necessarily penetrate deep into the body; instead, it matches the closing price of the first candle precisely after opening with a gap."
On 16,520 EURUSD 15-minute bars there are 1,583 pairs of long opposite-coloured bodies. Of those, 1,582 reached the first candle's close at all, 1,427 went past the midpoint of its body, which is the piercing and dark cloud cover threshold, and 825 went past its open, which is the engulfing threshold. Exactly 0 landed on the first candle's close.
The counterattack is an equality where the others are inequalities, and on a price quoted to five decimals an equality is a different kind of condition.
The piercing pattern and dark cloud cover have their own rules and their own thresholds. Angel One also names the kicker, where "a Kicker pattern shows an even more aggressive gap where the second candle opens beyond the entire range".
Does the second candle have to gap?
Several guides require a gap. Neither specification mentions one.
Angel One is the firmest, and its note on the gap opens and ends like this: "Note: Candle 2 must open with a gap in the direction of the existing prevailing trend... Without this gap, it is not a true Counterattack pattern." Aron Groups lists "Opening with a Gap: The candle opens with a price gap in the direction of the previous trend." FXOpen gives it its own heading in both halves. Elearnmarkets' identification step is "look for a candle that opens with either a 'gap up' or a 'gap down.'"
Against that: the library's text contains no gap condition, and the only time the string appears on its page is in the name of a different function in its See Also list. thinkorswim's page does not use the word at all. Tradeorca and Bajaj Finserv do not require one either, and Bajaj Finserv asks only that the second candle "opens lower than the previous candle", which is weaker than a gap.
It depends entirely on your close tolerance, and the two interact in a way none of these pages mentions. On the 1,583 EURUSD 15-minute pairs above:
| Close tolerance | Candidates | Gap measured on candle 1's close | Excluded by that gap test | Gap clear of candle 1's whole range |
|---|---|---|---|---|
| 0 ticks | 0 | 0 | 0 | 0 |
| 1 tick | 0 | 0 | 0 | 0 |
| 2 ticks | 0 | 0 | 0 | 0 |
| 5 ticks | 1 | 1 | 0 | 0 |
| 10 ticks | 16 | 9 | 7 | 2 |
| 20 ticks | 215 | 85 | 130 | 13 |
At a 20-tick tolerance the gap requirement throws out 130 of 215 candidates. At a 5-tick tolerance it throws out nothing, because there is almost nothing left to throw out. Which gap you mean matters as much: 85 candidates clear the first candle's close, and only 13 clear its entire range.
Aron Groups is the only source that publishes code, and in it the gap line cannot do any work. Its bullish rule, with its named inputs filled in, comes to this on the same pair:
is_second_candle_bullish = close > open
is_second_candle_long = (close - open) > atr_value * 0.7
are_closes_near = math.abs(close - close[1]) < (atr_value * 0.1)
is_gap_down = open < close[1]
Take the three conditions above the gap line. From the proximity test, close < close[1] + 0.1 * atr. From the body test, open < close - 0.7 * atr. Substituting gives open < close[1] - 0.6 * atr, so open < close[1] is already true whenever the other three hold. The gap line can never exclude a pair that its own rule would otherwise accept. The measurement agrees: its gap test excluded 0 pairs in all eight cells we ran.
The code does what it says. Its gap condition is simply implied by its other conditions, which is easy to miss when you read a rule list instead of solving it.
How close is "nearly equal"?
TA-Lib writes "(nearly)" and stops. Aron Groups is the only source that gives a number: close_proximity_factor = 0.1 // Closing prices must be within 10% of ATR of each other, with atr_period = 14 and relative_body_size = 0.7.
On EURUSD 15-minute bars, 682 pairs meet its two body rules, and the closest any of their closes came to each other was 60.3% of ATR, six times its own threshold. On hourly, four-hour and daily EURUSD bars the nearest misses are wider still, at 69.4%, 72.3% and 76.3% of ATR, and its full rule fires nowhere on EURUSD. On GER40 15-minute bars, where 629 pairs meet the body rules, one pair came within 6.8% of ATR and its whole published rule fires twice. One of those two also met the page's separate preference that the second candle "cover at least 80% of the first candle's body".
That 10% figure is Aron Groups' number, quoted as published. It is not the right threshold and none is offered here. A counterattack count without a stated tolerance beside it is not a number at all, and Angel One's own page shows how slippery the wording gets: it says the second candle "matches the closing price of the first candle precisely" in one paragraph, while its own comparison table asks it only to "close at or near the exact close of Candle 1".
Our ATR is a plain mean of true range over 14 bars, where Aron Groups' ta.atr(14) is Wilder's smoothing. The two differ, and the difference cannot turn a zero into a hit at these distances.
How often does a counterattack actually print?
On thinkorswim's exact-equality rule, 0 times in every cell we ran.
Our data, cleaned tick data from Dukascopy, covers EURUSD, 246,778 one-minute bars, and GER40, the euro-quoted German 40 index, 225,951 one-minute bars, from 1 January to 31 August 2026, aggregated from 1-minute candles, our lowest timeframe. Prices are carried in whole ticks.
| Cell | Series length | Two long opposite bodies | Closes equal to the tick |
|---|---|---|---|
| EURUSD M15 | 16,520 bars | 1,583 | 0 |
| EURUSD H1 | 4,130 bars | 382 | 0 |
| EURUSD H4 | 1,068 bars | 80 | 0 |
| EURUSD D1 | 208 bars | 14 | 0 |
| GER40 M15 | 15,181 bars | 1,409 | 0 |
| GER40 H1 | 3,897 bars | 354 | 0 |
| GER40 H4 | 1,041 bars | 91 | 0 |
| GER40 D1 | 207 bars | 19 | 0 |
The daily rows are 208 and 207 bars, which is eight months, and a small count has to be read with its sample.
thinkorswim defines it as an exact equality between two closing prices, that equality did not occur anywhere in our sample, and TA-Lib's nearly-equal wording leaves the tolerance to whoever does the counting. The test itself fires: a hand-built pair taken from the specifications' own wording, with the two closes set equal, returns a hit, and moving only the second close past the first candle's open turns it into the engulfing case instead.
GER40 is the one place anything fired, under Aron Groups' ATR-relative tolerance rather than a tick tolerance. A session break produces the kind of opening displacement this pattern was described from. On a pair that trades around the clock, a bar's open is the first tick inside that bar, so consecutive bars are joined by construction.
How do you backtest the counterattack pattern?
Four decisions, and all four go on paper before you count anything.
- The close tolerance, as a number in ticks or as a fraction of ATR. This is the whole test. Ours runs 0, 1, 2, 5, 10 and 20 ticks and the answers are 0, 0, 0, 1, 16 and 215.
- The body threshold for "long". Ours is a body greater than the 10-bar mean body. Aron Groups uses 70% of ATR(14). Neither specification gives a number: thinkorswim names a
lengthinput and publishes no default. - Whether you require a gap at all.
- Which gap you mean. Clear of the first candle's close, or clear of its whole range. On the same 215 candidates those two readings give 85 and 13.
Then count every condition separately rather than the pattern as a whole. A single total tells you nothing about which rule did the work.
The built-in Counterattack switch answers the tolerance question with the default in TA-Lib's code, its Equal setting: the two closes match when they are within 5% of the average high-low range of the five candles before the first one, and both bodies must be long against the candles before them. You cannot change that tolerance in the indicator, and there is no scanner and no price alerts. Replay is what the platform is for here: cleaned history, one bar at a time, so a two-candle equality can be counted in the order the market produced it. Writing the counter once beats judging it by eye across thousands of bars, and for your own tolerance the Pine Script editor will take all four decisions as constants and mark the pairs that satisfy them with a plotted shape or a label. "Example: Mark bars by a rule" on the Pine Scripts tab opens a copy to start from. Pine also has ta.rma, Wilder's smoothing, if you want the library's ATR rather than a plain mean. The script has to define the pattern itself, and there is no Pine backtesting, so the marking is as far as a script takes you and the trades stay yours.
What should you record?
Your four choices as written numbers, and the near-miss count next to the hit count.
- The close tolerance, in the unit you measured it in.
- The body threshold for "long", and where you took it from.
- Whether a gap was required, and which of the two readings you used.
- The candidate count at each condition, not just the final figure.
- The closest any candidate came to your tolerance. On this pattern that number is more informative than the hit count, because it tells you whether you were near a result or nowhere near one.
- The symbol, the months and the timeframe, every time.
Trades can be tagged inline in the Orders panel and analytics filtered by those tags, so the rule version stays attached to whatever you traded.
Related reading
- Forex backtesting, for why a gap-dependent rule behaves differently on a pair than on an index.
- Backtesting accuracy, slippage and data quality, for why a tolerance stated in ticks matters.
- Backtesting a trading strategy, for the method underneath all of this.
Next step
Pick a close tolerance, write it down in ticks, and count the candidates on a stretch of history you have not studied. Record the nearest miss as well as the hits.
Start a free trial and step through the bars yourself.
Related Topics
Related Guides
Forex Backtesting: Test Your Strategy on Real Data
A practical guide to backtesting forex strategies: why session dynamics, spread variation, and pair-specific behavior change your results, what clean historical data actually means, and a five-step process for testing a strategy before you risk real capital.
Backtesting Accuracy: How Slippage and Data Quality Matter
Why backtest results and live results drift apart, and what actually closes the gap: clean tick data, honest spread assumptions, and commission and slippage modelled directly on every trade you log.
Backtesting a Trading Strategy: A Beginner's Guide
What backtesting is, why it matters, and how to run one step by step: defining your rules, choosing clean historical data, stepping through the chart trade by trade, logging results, and reading the metrics that tell you whether your strategy has a real edge.