**This is an old revision of the document!**

Consolidating stocks may trade within a range for an extended time, but eventually they will break out of that range, usually in the same direction they were moving before the consolidation. Scanning is a great way to discover these stocks as they are breaking out.

When scanning for a consolidation breakout, there are four conditions/signals that you should look for:

- Has the stock been consolidating?
- Was the stock in an uptrend prior to that consolidation?
- Has the stock broken out of that narrow trading range?
- Has volume increased sharply, confirming the breakout?

Each of these four requirements will be discussed below, with specific scan clauses that can be used to test for each one.

The first step to identifying a consolidation breakout is to establish that the stock has been trading in a narrow range. Multiplication and min/max functions are useful for defining your own consolidation requirements, while technical indicators like Aroon Up/Down, Plus/Minus DI and Slope make it quick and easy to scan for a typical consolidation range.

This very simple example uses multiplication to determine that the closing price is within 2% of the closing price from 5 days ago:

[type = stock] and [today's close < 5 days ago close * 1.02] and [today's close > 5 days ago close * 0.98]

We calculate “within 2%” of the closing price 5 days ago by subtracting or adding 2% from that price. 100%-2% is 98%, so we will multiply the price from 5 days ago by 0.98 (98%) to get the lower limit of our acceptable range. Similarly, we will multiply by 1.02 (102%) to set the upper limit of our acceptable range, which is 2% above the price from 5 days ago. These multipliers allow us to determine if today's closing price is within the acceptable range.

For example, if the close 5 days ago was 30.0, then the lower limit would be 29.4 (30.0 * 0.98) and the upper limit would be 30.6 (30.0 * 1.02). Thus, today's close would need to be above 29.4 and below 30.6 to meet the criteria.

Of course, this example only compares two values at two different points in time; it doesn't determine how much fluctuation in price might have taken place between those two points.

The next example improves on this somewhat by comparing today's closing value to the *average* closing value over a period of time (in this case, 10 days):

[type = stock] and [today's close < today's SMA(10,close) * 1.02] and [today's close > today's SMA(10,close) * 0.98]

Note that consolidation is relative because some securities are naturally more volatile than others. When scanning, it is best to use percentage comparisons for the range of values over a period of time. Instead of checking whether the trading range spans $3 over the last 10 days, check to see whether it spans less than 4%, as in the example above. This is why multiplication is such an important aspect of consolidation scan clauses.

Using min/max with multiplication allows us to look at all values during the time period, rather than just the first and last values or the average value. In this example, we are comparing the highest and lowest values for the last 20 days in order to confirm that the entire range of trading values is within 3% above or below the current value:

[type = stock] and [today's max(20,close) < today's close * 1.03] and [today's min(20,close) > today's close * 0.97]

The second clause ensures that the lowest price over the last 20 days is still higher than the bottom of our range (3% below today's price). The third clause ensures that the highest price over the last 20 days is still lower than the top of our range (3% above today's price). If the highest and lowest prices are within the range, then we know that everything in between is also within the range.

Another way to define the range is to take today's closing price out of the equation entirely and just determine the overall size of the trading range. In this example, we are confirming that the total size of the range over the last 10 days is less than 4% of the stock's price:

[type = stock] and [today's max(10, high) < today's min(10, low) * 1.04]

This clause makes sure that the highest value over the last 20 days is no more than 4% higher than the lowest value in that time frame.

Using min/max functions improves your consolidation scans by accounting for any fluctuations that may have happened during the time period.

**Learn More:** Writing Min/Max Scans

Using technical indicators instead of multiplication and min/max functions keeps the math to a minimum and can make your consolidation clauses much simpler to follow. In the following example, prices are flat when Aroon Up and Down are below 50, Plus/Minus DI are below 30 and the Slope is near zero.

[type = stock] and [yesterday's max(5, Aroon Up(20)) < 50] and [yesterday's max(5, Aroon Down(20)) < 50] and [yesterday's max(5, Plus DI(20)) < 30] and [yesterday's min(5, Minus DI(20)) < 30] and [yesterday's Slope(20) < 0.3] and [yesterday's Slope(20) > -0.3]

Note that the same 20-period timeframe is used for all three indicators to ensure that we're measuring across a consistent timeframe.

The second step is to establish that the stock was in an uptrend prior to the consolidation. This can be tricky to do, as we may not know how long the consolidation has been going on. Here is one way to scan for an uptrend prior to consolidation:

[type = stock] and [today's close > today's SMA(50,close)]

In general, we would expect the close to be above the 50-day simple moving average when a stock is in an uptrend. Once the stock begins consolidating, it doesn't change drastically in price, so we expect the price to stay above the 50-day SMA while consolidating. Of course, if the price is very near to the 50-day SMA, it may occasionally dip below it during the consolidation, but this generally gives a reasonable indication of an uptrend prior to a period of consolidation.

Many chartists stop at this point, using only the uptrend and consolidation clauses in their scans. This allows them to scan for stocks that are currently consolidating, save those scan results to a ChartList and monitor them for future breakouts.

Here is an example:

[type = stock] and [today's close > today's SMA(50,close)] and [today's max(5, Aroon Up(20)) < 50] and [today's max(5, Aroon Down(20)) < 50] and [today's max(5, Plus DI(20)) < 30] and [today's min(5, Minus DI(20)) < 30] and [today's Slope(20) < .3] and [today's Slope(20) > -.3]

The second clause ensures that the stock is in an uptrend by checking that the stock's price is above its 50-day SMA, while the other six ensure that the stock is consolidating by checking for the appropriate Aroon Up/Down, Plus/Minus DI and Slope values.

If you want to scan for consolidation and breakouts all in one scan, then the third step is to establish that the stock is breaking out. Below are just a few of the ways you can find breakouts with scan clauses:

In addition to checking for values that are near each other in consolidation clauses, we can also use multiplication to look for values that are far apart from each other in breakout clauses. This example uses multiplication to determine that today's closing price is *at least* 6% higher than yesterday's closing price:

[type = stock] and [today's close > yesterday's close * 1.06]

Note that breakouts are also relative, meaning it is best to use percentages when determining if the value has changed enough to be considered a breakout. Instead of checking whether the price is $5 higher than average, for example, check to see if it is 6% higher than average.

The Bollinger BandWidth indicator defines the size of the trading range. When Bollinger BandWidth is small, the stock is trading in a narrow range, whereas, when it is large, the trading range is much larger. This example looks for a Bollinger BandWidth value that is 4 times (400%) higher than the highest value of the previous 5 days:

[type = stock] and [today's BB Width(20,2) > yesterday's max(5, BB Width(20,2)) * 4]

This scan clause builds both consolidation and breakout criteria into a single clause. Today's trading range size is four times larger than average (the breakout), which implies that the average size of the trading range prior to today was relatively small (the consolidation).

**Learn More:** Bollinger BandWidth

The last step is to use volume to confirm the breakout. Generally, volume is low while a stock is consolidating, but then increases sharply when the stock breaks out. If volume “breaks out” at the same time the price does, that is a much stronger signal than a price breakout with low participation.

Just like price breakouts, multiplication is key to determining volume breakouts. In this example, we are looking for stocks whose volume is 1.5 times (150%) greater than the average volume for the last 20 days:

[type = stock] and [today's volume > yesterday's SMA(20,volume) * 1.5]

Note that, just like everything else, volume is relative. This is why we look for volume that is a percentage of the usual amount, rather than requiring a specific number of additional shares traded. In scans, we usually define “heavy volume” as a multiple of the average amount of volume.

To scan for a consolidation breakout, you need to include all four types of clauses in your scan: uptrend, consolidation, breakout and volume confirmation.

In our previous examples, we were scanning for consolidation that was still going on at the time of the scan, so our uptrend and consolidation clauses were looking at today's values. Now that we are adding a breakout to the scan, we need to make some adjustments. Since we want to look for stocks that were consolidating yesterday and are breaking out today, we need to change our uptrend and consolidation clauses to look at yesterday's data.

Building on Example #1, this new version scans for a consolidation yesterday and a breakout today:

[type = stock] and [yesterday's close > yesterday's SMA(50,close)] and [yesterday's max(5, Aroon Up(20)) < 50] and [yesterday's max(5, Aroon Down(20)) < 50] and [yesterday's max(5, Plus DI(20)) < 30] and [yesterday's min(5, Minus DI(20)) < 30] and [yesterday's Slope(20) < .3] and [yesterday's Slope(20) > -.3] and [today's close > yesterday's SMA(20,close) * 1.06] and [today's volume > yesterday's SMA(20,volume) * 2]

This example covers all four types of clauses:

**Uptrend:**The second clause ensures that yesterday, when the stock was still consolidating, its close was still above the 50-day SMA.**Consolidation:**The third through eighth clauses ensure that yesterday's 20-day Aroon Up/Down, Plus/Minus DI and Slope values are all indicating consolidation.**Breakout:**The ninth clause ensures that today's closing price is at least 6% higher than yesterday's 20-day moving average.**Volume Confirmation:**The final clause ensures that today's volume value is at least 2 times yesterday's 20-day moving average of volume.

Again, notice that a 20-day period is used throughout the scan, to ensure that all clauses are looking at a consistent timeframe. The uptrend clause, of course, uses a longer period in order to determine the trend prior to the consolidation.

When scanning for consolidation, there are many options available. You can scan for a consolidation by itself and build a watchlist to monitor for breakouts; alternatively, you can scan for a breakout after a consolidation. The scan clauses can be modified to specify how long the stock should consolidate, how narrow of a range it should trade in, how sharply (and in which direction) it should break out and how much volume should increase to confirm the breakout. All the scans in this article are just examples. In your own scans, each of these parameters should be adjusted to suit your personal trading style.