Skip to content

Program 24 | CCI hidden or reverse divergence

In Program 11 I created  a Commodity Channel Index (CCI) indicator that looked for regular divergence between price and CCI. This new indicator looks for hidden or reverse divergence between price and the CCI rather than regular divergence.

The following downloadable pdf file illustrates the difference between hidden and regular divergence. I also explain this in the video below. Click on the image to download the pdf file.

Note that in the examples the chart patterns in the two left columns could be classed as both regular and hidden divergence. The same is true for the two columns on the right. This is because the amplitude of the patterns shown is the same in both examples. When you are looking for divergence make sure that you are looking at the price or CCI action where I have drawn the trend lines.

Program 24 has:

  • An input that allows users to look for hidden divergences between price and the smoothed fast CCI
  • A user input allows the user the option of drawing a line when there is a possible hidden divergence. The line disappears if the hidden divergence. were not confirmed when the bar closes.
  • An input that means the program looks for potential hidden divergences consisting of two CCI pivots, an initial price pivot and then a price occurring on the same bar as the second CCI pivot that indicates a possible divergence. The second price ‘sampling’ does not necessarily need to be a price pivot. The idea is that it could possibly give the user early warning of a divergence, prior to the price pivot occurring

I explain these new features in the video below.

This UNPROTECTED TradeStation EasyLanguage indicator and a PROTECTED smoothed CCI function are available for immediate download for $69.95. The indicator is commented throughout. Click on the ‘add to cart’ button to pay using a credit card or PayPal. The download includes a plain text version of the program (but not of the the protected CCI function).

The program was developed in TradeStation 9.0  and works on intraday, daily, weekly, and monthly charts.

You can also download a packaged bundle of programs 11 and 24 for a special discounted price of $119- (i.e. $20 off the regular price for both programs bought separately). Click on the ‘add to cart’ button to pay using a credit card or PayPal.

If you are a Gold Pass member make sure you enter the special coupon code to get 20% discount off these prices.

The following images show the Program 11 and Program 24 smoothed Markplex CCI indicator, compared with the CCI indicator supplied with TradeStation.


As with program 11, program 24 also looks for cases where the smoothed CCI pivot may match the second most recent price pivot OR the one before it (i.e the third most recent price pivot). ‘Secondary’ divergences, as I refer to them here, are drawn in magenta or cyan. ‘Primary’ divergences are drawn in red or green. I have included a comprehensive color guide below.

Program 24 applied to a 1 minute GBPUSD chart. A bearish hidden divergence is shown by the red line drawn on the chart. The price has made a lower (or equal) high and the smoothed CCI has made a higher high.

The program includes a feature enabling the user to modify a user input to look for divergences between price and the smoothed fast CCI. This is illustrated in the image below where hidden divergence between price and the smoothed CCI and price and the smoothed fast CCI, occur on the same bar. Notice the two lines, one red and the other dark red. The dark red line shows potential divergence between price and the smoothed, fast CCI.

Program 24 applied to a 1 minute GBPUSD chart. The chart shows a reverse or hidden divergence between price and the smoothed fast CCI. The darker lines represent divergence with the fast CCI.

The following image gives an example, of what I have described as ‘secondary’ divergence.’ Notice an intervening low price pivot in price between the two high price pivots. This is ignored and hence we show a ‘secondary’ divergence in magenta.

The magenta line illustrates what I have described as secondary divergence. We take the most recent price pivot and the third most recent price pivot and we compare them with the two most recent CCI pivots. I explain this in the video.

The following image shows a bullish hidden divergence.

An example of a bullish hidden divergence
A bullish secondary divergence.

Plots

Plot1 = Regular CCI
Plot2 = Smoothed CCI
Plot3 = Smoothed CCI (may be plotted as a histogram)
Plot4 = Smoothed Fast CCI
Plot5 = ‘OverBought’ horizontal line
Plot6 = ‘OverSold’ horizontal line
Plot7 = Zero horizontal line

in addition plots Plot 8 to Plot 23 plot 100 when divergences occur.

See a video demonstration below.

Bear in mind that this indicator is a tool and consequently you will likely need to adjust the various inputs to obtain potentially useful information. It is also worth noting that it is still important to carefully look at the chart to ensure that potential divergences really exist. You would also need to find confirming signals or indicators prior to trading.

This UNPROTECTED TradeStation EasyLanguage indicator and a PROTECTED smoothed CCI function are available for immediate download for $69.95. The indicator is commented throughout. Click on the ‘add to cart’ button to pay using a credit card or PayPal. The download includes a plain text version of the program (but not of the the protected CCI function).

The program was developed in TradeStation 9.0  and works on intraday, daily, weekly, and monthly charts. The indicator can also be applied to tick charts and the CCI plots work correctly, however, on a tick chart several bars can have the same time signature, this means that the divergence lines may not calculate or draw accurately. Provided you always double check possible divergences, the tool may still be useful on tick chart analysis.

You can also download a packaged bundle of programs 11 and 24 for a special discounted price of $119- (i.e. $20 off the regular price for both programs bought separately). Click on the ‘add to cart’ button to pay using a credit card or PayPal.

If you are a Gold Pass member make sure you enter the special coupon code to get 20% discount off these prices.

See the video below for more information.

User inputs

SmoothCCIFastDiv( TRUE ), // If TRUE also draws hidden divergences between price and SmoothCCIFast
EarlyWarning( TRUE ), // If FALSE waits until end of bar to draw divergence, otherwise it draws line if divergence condition in place during bar formation
OnePricePivDiv( FALSE ), // If TRUE looks for 2 pivots in CCI and only the first one in price
ShowLines1( TRUE ), // If TRUE draws lines to illustrate potential hidden divergences
ShowLines2( TRUE ), // If TRUE draws lines to illustrate potential hidden ‘secondary’ divergences
LineSeparator( MinMove / PriceScale ), // Determines vertically how far apart certain divergence. lines are drawn
LowerLine( -100 ), // Used to draw horizontal line at the user input level
UpperLine( 100 ), // Used to draw horizontal line at the user input level
LowerColor( Green ),
UpperColor( Magenta ),
CCIFastColor( Red ), // Color of fast smoothed CCI
SmoothCCIColor( Cyan ), // Color of smoothed CCI
CCIColor( DarkGray ), // If ‘legacy’ CCI drawn, specify its color
ShowRegularCCI( FALSE ), // If TRUE ‘legacy’ CCI drawn
HorizLines( DarkGray ), // Color of horizontal lines
CCILength( 14 ), // CCI length
FastLength( 6 ), // Length of ‘fast’ CCI
SmoothLength( 14 ), // Factor used to smooth CCI
FastSmoothLength( 14 ), // Factor used to smooth fast CCI
Length ( 20 ), // Lookback length when looking for pivots (used to find divergences)
LeftStrength( 3 ), // Left strength of pivots
RightStrength( 1 ), //Right strength of pivots
BarTol( 3 ), // The number of bars within which the price and CCI pivot must occur for the pivots to be considered to have occurred at the same time
PriceL( Low ), // Price used to find low pivots
PriceH( High ); // Price used to find high pivots

Divergence color Key

The colors below refer to the lines drawn on the price chart.

Low price pivots are based on the PriceL input. High price pivots are based on the PriceH input.

The key to ‘position’ in the table below is as follows:

O = Drawn between the high or low price pivots, depending on the type of divergence. For example, hidden divergence between two low price pivots and two low smoothed CCI pivots would be drawn between the two low price pivots.

A = Drawn above the high or low pivots by a user specified amount (LineSeparator), depending on the type of divergence. For example, hidden divergence between two high price pivots and two high smoothed CCI pivots would be drawn between the two low price pivots plus the amount specified in LineSeparator. If OnePricePivDiv is set to TRUE the line is drawn between the first pivot plus the amount specified in the LineSeparator input and the price on the bar where the second CCI pivot occurs plus the amount specified in the LineSeparator input.

B = Drawn below the high or low pivots by a user specified amount (LineSeparator), depending on the type of divergence. For example, divergence between two low price pivots and two low smoothed CCI pivots would be drawn between the two low price pivots less the amount specified in LineSeparator. If OnePricePivDiv is set to TRUE the line is drawn between the first pivot less the amount specified in the LineSeparator input and the price on the bar where the second CCI pivot occurs less the amount specified in the LineSeparator input.

DESCRIPTION COLOR POSITION
Price low pivot hidden divergence between two low price pivots and two low smoothed CCI pivots GREEN O
Price low pivot hidden divergence between two low price pivots and two low smoothed FAST CCI pivots DARK GREEN B
Price high pivot hidden divergence between two high price pivots and two high smoothed CCI pivots RED O
Price high pivot hidden divergence between two high price pivots and two high smoothed FAST CCI pivots DARK RED A
‘Secondary’ price low pivot hidden divergence between two low price pivots (the most recent and the second most recent) and two low smoothed CCI pivots CYAN O
‘Secondary’ price low pivot hidden divergence between two low price pivots (the most recent and the second most recent) and two low smoothed FAST CCI pivots DARK CYAN B
‘Secondary’ price high pivot hidden divergence between two high price pivots (the most recent and the second most recent) and two high smoothed CCI pivots MAGENTA O
‘Secondary’ price high pivot hidden divergence between two high price pivots (the most recent and the second most recent) and two high smoothed FAST CCI pivots DARK MAGENTA A
OnePricePivDiv set to TRUE. Price low pivot hidden divergence between two low smoothed CCI pivots, one low price pivot and the price that occurred at the most recent CCI pivot LIGHT GRAY B
OnePricePivDiv set to TRUE. Price low pivot divergence between two low smoothed FAST CCI pivots, one low price pivot and the price that occurred at the most recent FAST CCI pivot DARK GRAY B
OnePricePivDiv set to TRUE. Price high pivot divergence between two high smoothed CCI pivots, one high price pivot and the high price that occurred at the most recent CCI pivot LIGHT GRAY A
OnePricePivDiv set to TRUE. Price high pivot hidden divergence between two high smoothed FAST CCI pivots, one high price pivot and the high price that occurred at the most recentFAST CCI pivot DARK GRAY A
SECONDARY DIVERGENCE. OnePricePivDiv set to TRUE. Price low pivot hidden divergence between two low smoothed CCI pivots, one low price pivot (the second most recent) and the price that occurred at the most recent CCI pivot DARK BROWN B
SECONDARY DIVERGENCE. OnePricePivDiv set to TRUE. Price low pivot hidden divergence between two low smoothed FAST CCI pivots, one low price pivot (the second most recent) and the price that occurred at the most recent FAST CCI pivot DARK BROWN B
SECONDARY DIVERGENCE. OnePricePivDiv set to TRUE. Price high pivot hidden divergence between two high smoothed CCI pivots, one high price pivot (the second most recent) and the price that occurred at the most recent high CCI pivot DARK BROWN A
SECONDARY DIVERGENCE. OnePricePivDiv set to TRUE. Price high pivot hidden divergence between two high smoothed FAST CCI pivots, one high price pivot (the second most recent) and the price that occurred at the most recent high FAST CCI pivot DARK BROWN A

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, 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.

This UNPROTECTED TradeStation EasyLanguage indicator and a PROTECTED smoothed CCI function are available for immediate download for $69.95. The indicator is commented throughout. Click on the ‘add to cart’ button to pay using a credit card or PayPal. The download includes a plain text version of the program (but not of the the protected CCI function).

The program was developed in TradeStation 9.0 and works on intraday, daily, weekly, and monthly charts.

The included function is ‘protected,’ in other words, you will not be able to see and edit the source code, but you will be able to apply it to a chart and modify the inputs.

You can also download a packaged bundle of programs 11 and 24 for a special discounted price of $119- (i.e. $20 off the regular price for both programs bought separately). Click on the ‘add to cart’ button to pay using a credit card or PayPal.


Video demonstration of Program 24

Using Program 24 with the TradeStation Scanner

Please email any bugs that you may discover to support@markplex.com.

Program 24 used with the TradeStation Scanner and linked chart

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, 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.