With The Divergence Index
Divergence, a popular technical term used to denote a market movement in one direction when a technical indicator fails to follow it, can forewarn of a reversal in market direction. However, divergence has been difficult to quantify. Here's one software engineer's approach to tracking divergence. By Matt Storz
Divergence between market prices and an indicator applied to those prices can provide a strong signal of an
impending price reversal. For example, when prices make new highs but the indicator does not, an important market
top may be forming. After reading some references describing divergence, I began to wonder if there was a way to
measure it systematically. If there were, I reasoned, it would be useful for searching large portfolios and generating
signals in trading systems.
Here's a way to measure divergence between price highs and an indicator to predict the strength of a new market top.
This method could also be used to measure the divergence between price lows and an indicator to predict the strength
of a new market bottom. In addition, instead of measuring the divergence between prices and an indicator, it could be
used to measure the divergence between any two values - two different prices or even two different indicators.
The first problem I encountered was how to select a previous peak to compare with the current one. In many of the
examples that I have seen in my reading, the author's choice appeared to be a subjective one. Therefore, in order to
develop a system for measuring divergence, I had to first devise a system with which to measure peaks.
One way to measure the strength of a peak is to count the number of lower highs to the left and the right of it.
Clearly, a peak with 20 lower highs on each side is more significant than one with only two. The number of lower
highs on each side of the peak can be used to decide which peaks to use for measuring the divergence. The
divergence can be measured between shorter-term, less significant peaks by using a lower number or between
longer-term, more significant peaks by using a higher number.