# Picking Stocks at the Second-Wave Breakout: Big Prior Rally, Low-Volume Consolidation, Then a High-Volume Long Red Candle

- Channel: 量化交易科學園區 - 江加宏
- Published: 2023-06-17
- Series: [Quant Trading Science Park](https://xknow.app/en/s/quant-trading-science-park/?ref=agent) ([series index](https://xknow.app/en/s/quant-trading-science-park/llms.txt))
- Topics: [Technical Analysis](https://xknow.app/en/topics/technicals/llms.txt), [AI & Software Engineering](https://xknow.app/en/topics/ai-engineering/llms.txt)
- Page: https://xknow.app/en/v/quant-trading-science-park-ep17/?ref=agent
- YouTube: https://www.youtube.com/watch?v=JAjv6PSORow

> To catch the second-wave breakout point of a strong stock, you must first describe the pattern of a big prior rally, low-volume consolidation and a high-volume long red candle item by item in plain language, because only then can it be turned into a stock-screening program; ideas based on intuition alone are hard to convert directly into code.

## Key ideas

- The target pattern has 3 parts: the prior-wave high is the highest point within 300 days with a gain of 50% or more, the consolidation zone lasts 30 days or less with shrinking volume, and the last day is a high-volume red candle that makes a 3-day high; each part must be quantified into conditions that can be checked.
- Before writing code, describe the pattern in plain language, because many people's ideas are subjective and intuitive and not thought through from a programming angle, so they often can't be converted into code; the more detailed the conditions, the easier they are to code.
- The implementation order is to first find the prior-wave high and the heavy volume there, then check in sequence the gain, the number of consolidation days, the volume contraction and the pullback size, and only last check today's candlestick; today's candle is excluded when finding the high, and heavy volume is found by comparing the volume of the 3 candles around the high (before, at and after).
- The data length must be set explicitly: the wave length plus the longest consolidation of 30 days plus a 10-day buffer, so 40 extra days are fetched; otherwise the fetched data may be wrong and different people running the same program will get different results.
- The pullback is limited to within 20% in order to exclude A-shaped reversal patterns; the selected stocks can then be screened further on fundamentals and financials, saving time in finding stocks on technicals.

## Section summaries

### 0:05 Describing the Post-Consolidation High-Volume Long Red Candle in Plain Language

This explains how to catch a red candle where volume returns after a big prior rally and a low-volume consolidation, which is a possible second-wave breakout position. The approach is that you must first describe the pattern conditions item by item in plain language, and then convert them into code, rather than judging by intuition alone.

[Page](https://xknow.app/en/v/quant-trading-science-park-ep17/?ref=agent#s-0) | [YouTube 0:05](https://www.youtube.com/watch?v=JAjv6PSORow&t=5s)

### 2:35 How to Write the Screening Conditions and a Hands-On Demonstration

First set the wave-period parameter and use two variables to record the position of the prior-wave high and the heavy volume there; the data length is set to the wave length plus 40 days (consolidation of at most 30 days, plus a 10-day buffer) to avoid fetching wrong data. Today's candle is excluded when finding the high, and heavy volume is found by comparing the volume of the 3 candles: the one before the high, the high itself and the one after. Then check in sequence: the prior-wave gain exceeds 50%, consolidation lasts 5 to 30 days, the average volume in the consolidation zone is 30% or less of the maximum volume, the pullback does not exceed 20%, and finally confirm that today is a red candle, with volume at least 50% higher than in the consolidation zone, making a 3-day high. Once the program is added to the stock screener, the stocks it finds can be screened further on fundamentals and financials.

[Page](https://xknow.app/en/v/quant-trading-science-park-ep17/?ref=agent#s-1) | [YouTube 2:35](https://www.youtube.com/watch?v=JAjv6PSORow&t=155s)

---

Full notes (with slides) and other episodes in this series: https://xknow.app/en/v/quant-trading-science-park-ep17/?ref=agent

Watch the original video: https://www.youtube.com/watch?v=JAjv6PSORow
