In my last post I talked about a strategy for trading divergence events between different markets. In this post I’ll look at the more commonly used method called oscillator divergence.
This is a technical strategy and to use it you’ll just need an oscillator such as MACD, stochastic or RSI.
What is divergence? Divergence highlights places where momentum is slowing and is likely to reverse. The basic idea is to look for inconsistency between the price and an oscillator. Clearly price is reacting in real time. The oscillator however is based on price momentum and is working from recent history.
In the strategy described here I always take cue from the oscillator so this dictates the direction of the trade. To experiment with this strategy yourself, you can freely download my indicator and try it out.
The rules I use are simply as follows:
|Oversold and rising||Falling||Buy|
|Overbought and falling||Rising||Sell|
These two cases are shown in Figure 1 below.
I don’t apply any other classifications. With this method I always follow the oscillator. That is, buys take place when the oscillator is oversold and sells occur when it is in the overbought region.
I also always match tops with bottoms. That is, if your trend line on the price chart connects low points, then your trend line in the oscillator chart should also connect lows. If your line on the price chart connects highs, then your oscillator line should also connect highs.
Regular and Hidden Divergence: Is there a difference?
Some teaching websites talk a lot about regular and hidden divergence. Hidden divergence is basically an extra classification based on which direction the connecting lines are moving.
Personally I think this complicates the trading rules and I don’t use it. In the end don’t get hung up on classifications. Use what works for you and the market you are trading.
Detecting Divergence Events: In Detail
Let’s look in detail at how to detect these types of events.
All oscillators have a range of values. When the oscillator is at one of these extremes it’s said to be either overbought or oversold. So the first step in the detection process is to look at cases where the oscillator is firmly in overbought or oversold territory.
The range of an oscillator will vary significantly at different points in the chart. So I usually define dynamic thresholds for overbought and oversold rather than using one setting. In my examples I’ve used a sampling size of 50 bars and taken the maximum and minimum values of the oscillator over that range. I then set a threshold at a percentage of that, say 70%.
This setup is shown in Figure 2.
Once you’ve established the overbought and oversold levels within the local chart section, look for cases above/below these thresholds. Anything outside of these limits is thrown out.
Take Figure 2 as an example. I’ve set the threshold for overbought and oversold levels at 70% of the maximum/minima within the sampling area. The lines shown on the figure mark the cut-off levels.
Next I look at the oscillator’s peaks or troughs that are within my threshold according to my trading rule. When overbought, I look for cases where the oscillator’s peaks are falling.
In Figure 2 above, the dark blue line in the lower graph connects the peaks. To confirm a point really is a peak, I have to wait a certain number of bars to see which direction the line will move in next. If the line were to move up, then I know that this isn’t a peak. In this example the line does indeed move down and so the point is confirmed as being a maxima.
Next check the price and make sure the direction is moving against that of the oscillator. So as in the example above when the oscillator is overbought and falling, I look for cases where the price is still rising. These define my sell signals.
The buy side signal is simply just the opposite of this. This is shown in Figure 3. In this case the oscillator is oversold and rising, but the price is still falling, so this generates a buy signal according to my trading rule.
When trading divergence remember that there is always a certain time lag before the trade signal can be generated. The reason for this is that you can only ascertain that a peak or trough has been reached in the oscillator after a certain number of bars.
In the example above I used 2-bars for the detection. So I waited for 2 bars to complete before classifying the indicator as in a maxima or minima. This means there’s a lag of at least 2 candles on every detection. And this has to be added to the intrinsic lag of the indicator.
Latency does limit profits in that part of the price move will already be underway by the time the oscillator reacts and the divergence signal is detected. Latency can be seen as the “cost paid” for using averaging and reacting to a more complete signal. It does reduce the number of noisy or false positive signals, though these do still occur as explained below.
Dealing with False Positives
As with any kind of technical signal, false positives are expected and have to be dealt with. If your trading program is going to rely heavily on divergence my advice is to use a few different inputs to ensure you enter the highest probability trades and avoid those with low or marginal outcomes.
Figure 4 shows a typical problem case that’s common when trading divergences. The first buy signal is made when the oscillator appears to have made a local minima (reached a trough). This is outlined with the lower red circle.
The red circle is neither a maxima nor a minima but an inflection point that we would rather not trade on. You have to be wary of this because “text book” divergence examples are often cherry picked with hindsight and would not be detectable in real time. With the benefit of hindsight the detection of the peaks and troughs is easy.
But in real trading, at any instant there is no way of knowing that the current bar in the chart is an inflection or a minima.
In fact the price doesn’t change direction but continues to descend sharply. This in turn causes the oscillator to fall further. The second, more accurate buy signal is generated at the later point when in fact the price does respond and begin to rise again.
There are two methods to try to filter these false positives. Though both have some drawbacks.
Firstly you can increase the sampling area of detector. In other words, filter out the cases where the overbought or oversold level is not extreme. This will help to reduce the number of false cases. But it comes at a cost of detecting fewer overall divergence events. This needs to be weighed up against the strategy being implemented.
Secondly you can increase the number of confirmation bars that you use to check the extrema points in the oscillator. For example, in the above if I’d used a window of 5 bars, the above false positive would have been avoided because by that time the oscillator starts to fall again. This will increase the lag in the detector but it can improve accuracy.
Here are a few case studies picked out with the help of the OSC divergence indicator.
This first example shows a near perfect scenario. I’ve applied the above trading rules to USDCAD. I’ve used the four hour (H4) chart here as this timeframe tends to produce more reliable signals than do the shorter ones. The following settings were used:
- Oscillator: MACD
- Overbought/oversold threshold: 30%
- Min/max bars: 14/100
For MACD I used the following settings throughout: Fast EMA:15, Slow EMA:30, SMA:9.
As Figure 5 shows, all cases except trade 3 result in decent profit potential. Trade 3 is a mixed case. It is a false positive in that the price continues to fall. However the trade would still be profitable because the price does indeed rise shortly afterwards.
This next example on NZDUSD shows some false positives.
Trades 2, 3 and 5 generate good openings while trades 1 and 6 are mixed cases. These might scrape a small profit but in hindsight we would probably prefer not to trade these.
Trade 4 is an outright loser. If this trade were taken, it would be in drawdown (up to 300 pips) for a few weeks before it could eventually be closed with a small profit. Trades 7 and 8 also falsely call the top of the trend which in fact continues up strongly for some time.
To filter some of these false positives I’ve increased the sampling area from 50 bars, to 2000 bars. The result is shown in Figure 7 below. Now some of the false positives have been removed, though as you can see the overall number of trades is reduced.
This next example shows divergence in action on a shorter timeframe.
Finally in Figure 9 I’ve replaced the MACD oscillator with the RSI. The RSI generates some good entries which are missed when using MACD in Figure 8. These are marked 1, 2, 4 and 6 below. Using RSI also misses the false positive between trades 1 and 2. It does however create some additional false positives at 3 and 5.
Strengths and Weaknesses of Divergence
Oscillator divergence is a good way to trade turning points in trends, though it helps to be aware of the strengths and weaknesses of this method.
The first weakness as I said above is due to the time lag. All oscillators are averaging systems of one sort or another. This introduces some inherent delay. Secondly the detection of the maxima and minima in the oscillator introduces an additional lag.
The second weakness is that of false positives or false reversals. These occur when the oscillator is in an overbought/oversold state and is signalling a turn but this fails to emerge at the predicted time. This is quite common. There are a few ways I discussed to address this.
The thing to remember with oscillators is that they are just another representation of the price line. There isn’t anything magical in the oscillator window. All information is derived from the price with a time lag. If you look carefully at the price chart you will usually see the reason for the change in the oscillator – usually changing momentum.
Divergence is a valuable technique to keep in your toolbox. But it pays to get confirmation of the market direction using other means as well: In particular:
- Using a pair of alternative oscillators such as RSI and MACD is helpful.
- Look for clues to fake tops/bottoms and ensure you are not entering at one of these
- Examine the trend carefully using other criteria; e.g. support and resistance
- Look at related markets for trend cues. Intermarket studies can tell you if the leader market is trying to break away in a new direction or if it’s resuming an existing trend.
- Don’t forget the fundamentals
Here is the link to the indicator used for the above examples:
- OSC divergence indicator (download) | Read More
It can work as a intraday strategy. BUT the major gripe I have with divergence is that you have to put a lot of trust into the signal because most times you are going against the trend. Anyone who does reversal trades knows the risk is great that the trend would carry on much further than you can anticipate or more important beyond your stop value.
Like many systems I have seen divergence presented in other trade forums. But to offer a relative chance of winning on each and every occasion I say also it is compulsory to use other thing to verify the direction before the trade is made. Thank you.
Which other things you are using?