Plotting Price Divergences

This Demonstration implements divergence tracking between the price of an asset and various technical indicators. The divergence between the price behavior of an asset and the market attitude toward that asset is a powerful predictor of changes in the price trend. Technical analysis involves the development of indicators that are able to give an objective measure of the market's attitude. The theory is that such indicators can be used to predict (or confirm) the changes in trend, and thus offer a kind of crystal ball for the market. In this context, divergence is defined as the failure of an indicator to confirm the price behavior of the underlying asset. For example, if the asset price reaches an all-time high, but the technical indicator fails to confirm this by at least reaching the level attained when the price was at the previous maximum, there is a divergence. A random lognormal price action (middle box) and volume (lower box) are used and technical indicators for it (upper box) are constructed based on (in increasing order of abstraction) the Relative Strength Index (RSI), the On-Balance Volume (OBV), and the Volatility Index (VIX). For each sensitivity setting (i.e., detection of price extrema), the three highest negative and positive divergences are plotted. The vertical green and red lines indicate the point when maximum divergence is reached, while the short sloped lines indicate the strength of the divergence. When sensitivity is high (i.e., almost every price wrinkle is picked up), the various technical indicators are hardly in agreement about the importance of the turning points and are generally rather useless. But as the sensitivity is lowered and the peak detection becomes less noisy, the indicators become more reliable.


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


For more infromation on divergence, see Divergence.
For more information on the technical indicators used, see Stockcharts.com.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+