Skip to content

Tutorial177_consolidator | Recognizing periods of consolidation

T177-4

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
T177-5
Consolidation followed by trend
Consolidation followed by trend
T177-2
The 'key' should remind the users the colors chosen for the different rectangle types
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 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.

Download the tutorial 177 TradeStation EasyLanguage indicator

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. 

The download consists of _Tutorial177 (the TradeStation EasyLanguage indicator developed in the tutorial).

See tutorial 43 if you need help on how to import an ELD into TradeStation.

Available colors to use as user inputs to tutorial 177

AliceBlueDarkSlateGrayLightSalmonPaleVioletRed
AntiqueWhiteDarkTurquoiseLightSeaGreenPapayaWhip
AquaDarkVioletLightSkyBluePeachPuff
AquamarineDeepPinkLightSlateGrayPeru
AzureDeepSkyBlueLightSteelBluePink
BeigeDimGrayLightYellowPlum
BisqueDodgerBlueLimePowderBlue
BlackFirebrickLimeGreenPurple
BlanchedAlmondFloralWhiteLinenRed
BlueForestGreenMagentaRosyBrown
BlueVioletFuschiaMaroonRoyalBlue
BrownGainsboroMediumAquamarineSaddleBrown
BurlywoodGhostWhiteMediumBlueSalmon
CadetBlueGoldMediumOrchidSandyBrown
ChartreuseGoldenrodMediumPurpleSeaGreen
ChocolateGrayMediumSeaGreenSeashell
CoralGreenMediumSlateBlueSienna
CornflowerBlueGreenYellowMediumSpringGreenSilver
CornsilkHoneydewMediumTurquoiseSkyBlue
CyanHotPinkMediumVioletRedSlateBlue
DarkBlueIndianRedMidnightBlueSlateGray
DarkBrownIndigoMintCreamSnow
DarkCyanIvoryMistyRoseSpringGreen
DarkGoldenrodKhakiMoccasinSteelBlue
DarkGrayLavenderNavajoWhiteTan
DarkGreenLavenderBlushNavyTeal
DarkKhakiLawnGreenOldLaceThistle
Dark MagentaLemonChiffonOliveTomato
DarkOliveGreenLightBlueOliveDrabTurquoise
DarkOrangeLightCoralOrangeViolet
DarkOrchidLightCyanOrangeRedWheat
DarkRedLightGoldenrodYellowOrchidWhite
DarkSalmonLightGrayPaleGoldenrodWhiteSmoke
DarkSeaGreenLightGreenPaleGreenYellow
DarkSlateBlueLightPinkPaleTurquoiseYellowGreen

THE TRADING APPS, INDICATORS, SHOW ME STUDIES, STRATEGIES AND OTHER PROGRAMS HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES.

TO THE BEST OF MARKPLEX CORPORATION’S KNOWLEDGE, ALL OF THE INFORMATION ON THIS PAGE IS CORRECT, AND IT IS PROVIDED IN THE HOPE THAT IT WILL BE USEFUL. HOWEVER, MARKPLEX CORPORATION ASSUMES NO LIABILITY FOR ANY DAMAGES, DIRECT OR OTHERWISE, RESULTING FROM THE USE OF THIS INFORMATION AND/OR PROGRAM(S) DESCRIBED, AND NO WARRANTY IS MADE REGARDING ITS ACCURACY OR COMPLETENESS. USE OF THIS INFORMATION AND/OR PROGRAMS DESCRIBED IS AT YOUR OWN RISK.

ANY EASYLANGUAGE OR POWERLANGUAGE TRADING STRATEGIES, TRADING APPS, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (AND PARTS THEREOF) AND ASSOCIATED TECHNIQUES REFERRED TO, INCLUDED IN OR ATTACHED TO THIS TUTORIAL OR PROGRAM DESCRIPTION ARE EXAMPLES ONLY, AND HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES. MARKPLEX CORPORATION. DOES NOT RECOMMEND THAT YOU USE ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (OR ANY PARTS THEREOF) OR TECHNIQUES. THE USE OF ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS AND TECHNIQUES DOES NOT GUARANTEE THAT YOU WILL MAKE PROFITS, INCREASE PROFITS, OR MINIMIZE LOSSES.