ThreePeriodDivergence

Description

The Three Period Divergence strategy is a trading system developed by Perry Kaufman, which is based upon analysis of momentum-price divergence. Best applied to daily price data, this strategy identifies time points where a momentum indicator (in our case, the Stochastic) and the price move away from each other. Divergences occur in two directions: a bearish divergence is identified when the price rises and the momentum falls, a bullish divergence is vice versa.

While looking for divergences is quite a popular technique to follow, it is not always obvious which timeframe should be used or even how the divergence can be determined. Moreover, divergence signals can often be misleading, thus confirmation of these signals is crucial. Three Period Divergence addresses these problems as follows:

  • Divergence is looked for based on linear regression slopes of the momentum (either the FastK or the FastD component of the Stochastic) and the price;

  • Momentum needs to be defined on the period from five to 40 days;

  • Linear regression slopes for both the price and the momentum are found on three periods (Mr. Kaufman suggests that the first period be 5 days, the second period from six to 12, and the third one from seven to 15);

  • Divergence occurs when the signs of the momentum slope and the price slope are opposite;

  • In order to confirm the divergence, momentum slope is compared to the price slope on each of the calculation periods (the divergences must be all in the same direction).

Note: these periods are defined here as ranges; this is due to the fact that suitable periods differ from symbol to symbol, thus the strategy allows for optimization. Note also that searching for the divergence on each of the three calculation periods might reduce the number of signals. However, changing input parameters will allow you to search where the divergence occurs on at least two (or even one) of the three periods.

Once the divergence is identified, strategy adds simulated orders based on the dollowing rules: a buy signal is added when the bearish divergence occurs on the specified number of calculation periods out of three, and a sell signal when the bullish divergence is identified (on the same number of periods). Strategy will exit when all three price slopes are of the same sign as those of the momentum.

Input Parameters

Parameter Description
fast momentum Defines whether the momentum is calculated as the FastK component of the Stochastic (otherwise the FastD component is used).
momentum length Defines the period on which the momentum is calculated.
dvg length1 Defines the shortest of the periods for the calculation of slopes.
dvg length2 Defines the middle period for the calculation of slopes.
dvg length3 Defines the longest of the periods for the calculation of slopes.
entry number Defines the number of divergences sufficient for signal generation.
max divergences Defines on how many periods the price and the momentum need to move in the same direction for the strategy to exit.
long only Setting this input to "yes" will disable all short entry and short exit simulated orders.

Further Reading

1. "Slope Divergence: Capitalizing On Uncertainty by Perry Kaufman. Technical Analysis of Stocks & Commodities, June 2014.