# Tutorial177_consolidator | Recognizing periods of consolidation

Consolidation describes a period in time when a stock or security is not in or reversing a larger price trend. During consolidation the instrument typically trades within a limited price range. Tutorial 177 attempts to recognize periods of consolidation by calculating:

1. The standard deviation of price.
2. The ‘Consolidation Index’ by taking the average of true high over a number of bars, subtracting the average of the true low and dividing the result by the Average True Range.

The tutorial program then looks for when these values go below a user input percentile.

When a period of possible consolidation is found, tutorial 177 draws a box around it with the high of the box being the highest close of the price in the box and the low being the lowest low close of price in the box. The fill color of the box is determined by which way the consolidation was found and a user input (see SDevBox_Color and ConsolBox_Color).

Because periods of consolidation are sometimes associated with low volume the tutorial also changes the color
of the boxes when volume is below the average volume. The colors are also determined by user inputs (see
LVolSDevBox_Color and LVolConsolBox_Color.

In order to make it easier to see what user input color represents what a ‘key’ of the colors in drawn on the
chart in a fixed position.

### Technical lessons

This tutorial illustrates various programming techniques, including:

• Drawing rectangle and text drawing objects using BNPoints and XYPoints to specify their size and/or position
• Creating methods to draw rectangles and calling the methods
• Extending rectangles as new price bars form
• Modifying drawing object colors and transparency
• Using intrabarpersist booleans to detect when a percentile has been crossed
Consolidation followed by trend
The ‘key’ should remind the users the colors chosen for the different rectangle types
In this image Volume Avg is also applied to the chart
In its present form, tutorial 177 can be used with TradeStation but NOT with MultiCharts.

### Video walk through of tutorial 177

See a video walk through of tutorial 177.

If you want to save yourself some typing,  the tutorial 177 code is available for immediate download for \$29.95 by clicking the following button. You can pay using PayPal or credit card. The program works with TradeStation 9.5 and 10.