Testing Divergences

by Jul 19, 2019All Articles, Technical Analysis, Education

In the previous article we created formulas to show when bullish and bearish divergences occur between price action and the momentum indicator RSI(14). With those formulas saved in the Script Manager we can use them in other areas of Optuma, such as watchlist columns, the Scanning Manager, or Signal Tester.

For example, here’s a positive price and RSI divergence scan on the S&P500 stocks over the last month (note: because it takes at least one bar after a pivot for it to be confirmed it’s best to scan with a Date Range of something other than Last Bar).

Remember that scan results can be exported to a watchlist with your preferred columns and charts, so that whenever the watchlist is opened the list gets updated with the latest scan results.

If we can scan for a divergence signal we can therefore take it one step further and actually test these signals over time to determine whether there is empirical evidence that divergences are a useful technical analysis concept.


Testing Negative Divergence on the S&P500 stocks

With the S&P500 symbol list we are able to test using the historical survivorship bias-free data by selecting the Historical dataset and adding the IsMember(SYMBOLLIST=S&P 500) condition. In this setup we’re looking back over the last 5 years, with the results showing the average performance 5 trading days before each signal and 22 trading days (about a month) after:

Here are the results:

There were 796 negative divergences identified in those stocks over the last 5 years, and the statistics table tells us that 22 days after each signal 71% of the time the stock was lower, with an average pullback of 3.6%. While this might not have indicated a change in long-term trend it certainly shows that negative divergences have a significantly high probability of short term price impact.

In fact, if we extend the testing period to 6 months after each signal the mean return is positive, with the pullback ending – on average – about 5 weeks (27 periods) after the signal:


Testing Positive Divergence on the ASX200 stocks

In this example we’ll use weekly 10 bar RSI(7) pivots to calculate the positive divergences, as opposed to 15 bar RSI(14) pivots for the daily, using the Australian ASX200 survivorship bias-free data using IsMember(SYMBOLLIST=ASX 200).

Over the last 5 years there have been 153 instances of positive weekly divergence. For this universe and timeframe the results are even better, with the stocks on average being 16.8% higher 6 months (26 weeks) after each signal, with only a 25% chance of a loss:

So these results would indicate that based on these divergence signals that there is strong evidence to suggest that they can lead to a price reaction.


Additional test results

Here are a couple of additional test results that show the importance of identifying divergences for potential price reversals, as seen in different markets and timeframes.

Daily negative divergence on ASX 200 companies:

Weekly positive RSI(7) divergence on the S&P500 companies:

Remember that these are based on RSI() pivots, but with a couple of tweaks of the formulas in the Signal Tester then you can test using other indicators (such as Commodity Channel Index, or On-Balance Volume) and different pivot values. Here’s a forum post on OBV divergences, so feel free to post specific queries (or Signal Tester results) in the thread:

Forum Post – OBV Divergences

Share Link
Darren Hawkins, MSTA

Darren Hawkins, MSTA

Senior Software Specialist at Optuma

Darren is the senior Software Specialist at Optuma. He joined the company in 2009 after attending an introductory technical analysis course. Darren now instructs users all over the world, from experienced Wall Street traders and professional money managers to individual traders drawing their first trendlines.

Darren grew up in the UK and attended college in the USA where he earned a BA in Economics from St Mary's College of Maryland. He went on to spend a few years working at the Nasdaq Stock Market in Washington DC. Going on to live and work in Australia, the US and currently the UK, Darren has a broad understanding of the individual needs of traders, portfolio managers and investors utilising a wide range of methodologies.

In 2014 Darren passed the UK-based Society of Technical Analysts diploma course, and is in the process of studying for Level 3 of the CMT Program.

When not looking at charts, Darren keeps a keen eye on England's cricket team - especially if they are playing against Australia. He lives in the Essex countryside in England, with wife Wendy and their labrador, Gabba.


Submit a Comment

Your email address will not be published. Required fields are marked *

Blog Signup

Pin It on Pinterest

Share This

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.