You are on page 1of 5

From http://www.investopedia.com/terms/d/divergence.

asp

Divergence

What Does Divergence Mean?


When the price of an asset and an indicator, index or other related asset move in opposite directions. In technical
analysis, traders make transaction decisions by identifying situations of divergence, where the price of a stock and a set of
relevant indicators, such as the money flow index (MFI), are moving in opposite directions.

Investopedia explains Divergence


In technical analysis, divergence is considered either positive or negative, both of which are signals of major shifts in the
direction of the price. Positive divergence occurs when the price of a security makes a new low while the indicator starts to
climb upward. Negative divergence happens when the price of the security makes a new high, but the indicator fails to do
the same and instead closes lower than the previous high.
D3Spotter

The Divergence Spotter is an attempt to identify divergence between a selected indicator and price. It will plot
a line between the divergence points on both the price as well as on the indicator.

(screen shot from D3SpotterV1)

In the screen shot above the divergence spotter found a recent high/low indicated by the yellow dots. The
system determined that the price at yellow dot 1 was less than the price at yellow dot 2 AND the indicator value
at yellow dot A is greater than the value of the indicator at yellow dot B. Once a divergence is spotted a magenta
line is drawn between the points.

The yellow dots at points 1, 2, 3 and 4 are found by using the HighestBar() (NinjaTrader function). The Scan
Width is used to determine how many bars back to look. Once yellow dot candidates are found (up to 3 at a
time) the system compares candidate pairs for divergence against the selected indicator. If a divergence is found
the dots are plotted along with the magenta line.

The Red and Green Arrows are plotted once a divergence is identified, note this occurs at the end of the bar.
D3Spotter Indicator Parameters:

Description Default Value


DLC Divergence Line Color Magenta
DLW Divergence Line Width 3
DSD Divergence Dash Style Dot
Marker Distance Factor how far from the price high/low to display
MDF 1
the yellow dot, increments of ticks
High/Low scan width (how far back, in bars, to look for high/low
ScanWidth 30 bars
values
SoundAlert True/False flag to signal a divergence False
MyAlert1 When a candidate high is found for divergence comparison Alert1.wav *
MyAlert2 When a divergence is found Alert2.wav *
The difference in price the candidates must be when comparing for
PriceDiffLimit 0
divergence
The difference in indicator value the candidates must be when
IndicatorDiffLimit 0
comparing for divergence
The number of candidates to look back at when comparing values to
LookBack 3
determine divergence of candidates (consecutative)

* - the file is located in (depending on version):


C:\Program Files\NinjaTrader 6.5\sounds or
C:\Program Files\NinjaTrader 7\sounds

For all other parameters that appear on the Indicator Dialog please refer to the specific sub-indicators
parameters.
Indicators configured with the D3Spotter

RSI Relative Strength Index, a price-following oscillator that ranges between 0 and 100.

MACD Moving Average Convergence/Divergence, a trend following momentum indicator that shows the
relationship between two moving averages of prices.

StochasticsD, StochasticsK The Stochastic Oscillator is made up of two lines that oscillate between a
vertical scale of 0 to 100. The %K is the main line and it is drawn as a solid line. The second is the %D line and
is a moving average of %K. The %D line is drawn as a dotted line. Use as a buy/sell signal generator, buying
when fast moves above slow and selling when fast moves below slow.

FastStochasticsD, FastStochasticsK The fast versions of the Stochastics D & K

StochasticsRSI The StochRSI is an oscillator similar in computation to the stochastic measure, except instead
of price values as input, the StochRSI uses RSI values. The StochRSI computes the current position of the RSI
relative to the high and low RSI values over a specified number of days. The intent of this measure, designed by
Tushard Chande and Stanley Kroll, is to provide further information about the overbought/oversold nature of
the RSI. The StochRSI ranges between 0.0 and 1.0. Values above 0.8 are generally seen to identify overbought
levels and values below 0.2 are considered to indicate oversold conditions.

MFI Money Flow Index, momentum indicator that measures the strength of money flowing in and out of a
security.

ROC The Rate-of-Change indicator displays the difference between the current price and the price x-time
periods ago.

RVI The Relative Volatility Index was developed by Donald Dorsey as a compliment to and a confirmation of
momentum based indicators. When used to confirm other signals, only buy when the RVI is over 50 and only
sell when the RVI is under 50.

SMI Stochastic Momentum Index

DO Derivative Oscillator

The list is growing


D3Spotter History

D3SpotterV1

D3Spotter is an attempt to automatically identify divergence between the price and a sub-indicator. A sub-
indicator is any other pre-configured indicators such as MACD, Stochastics (D or K), RSI, etc. Additional
indicators can be configured or a custom indicator can be added to the set of sub-indicators to which divergence
is applied.

In this first attempt, I wanted to have a single indicator to determine divergence between price and a sub-
indicator, selectable directly on the Indicators Dialog, one of the parameters being Method. This would allow
the user to select the sub-indicator method for divergent comparison.

Yes, there were problem that user identified (greatly appreciated).

D3SpotterV2

Added some a few more indicators to the growing list.

Identified issues:
Didnt save parameters so when the user saved the indicator in a template all of the parameters went
back to their default.

D3SpotterV3

I was having some problems with drawing the sub-indicator when the indicator method changed. Sowith the
problems I was having in the drawing department I decided to break apart each of the indicators into its own
indicator, hence now there is D3SpotterMACD, D3SpotterRSI, D3SpotterCCI, etc.
This has created a new challenge; I am having to put the main D3Spotter code into each of the indicators, so
when I make a change to one I have to make a change to all of them.

One user pointed out that this indicator did not find hidden divergence, well the jury is still out however I think
I have correct that and now it does!

What the Future holds

Please comment and add your thoughts to make it a better indicator for all!

Final thoughts
If you feel compelled, I do take donations (small bill please )
Paypal: dadof3and3@yahoo.com

You might also like