The BBDivergence is a technical indicator developed by Markos Katsanos; it measures divergence between a security and a related market. Based on Mr. Katsanos’s article “Trading the Loonie”, this indicator’s values are used for recognizing trading signals in the related strategy.

The BBDivergence study estimates the divergence between two instruments using the following algorithm:

  1. The relative position within the Bollinger Bands® is calculated for both primary and secondary symbols.
  2. The divergence is calculated as the percentage difference between these two positions.
  3. The divergence is then analyzed in relation to two predefined levels, usually placed above and below the zero line.

As the author suggests, trading signals might be derived based on the behavior of the divergence plot; these signals are used in the BBDivergence strategy after confirmation by other technical indicators. A buy signal is suggested when the divergence rises above the upper level (set by default at 20%) and then starts declining. Vice versa, it might be interpreted as a sell signal when having fallen below the bottom level (-20% by default), the divergence reverses its direction.

Input Parameters

secondary symbol Defines the secondary security for divergence calculation.
length The length used in Bollinger Bands® calculation.


Divergence The BBDivergence study plot.
UpperLevel The top reference level.
ZeroLine The zero level.
LowerLevel The bottom reference level.

Further Reading

1. "Trading The Loonie" by Markos Katsanos. Technical Analysis of Stocks & Commodities, December 2015.

Bollinger Bands® is a registered trademark of John Bollinger.


*For illustrative purposes only. Not a recommendation of a specific security or investment strategy.

  Past performance is no guarantee of future performance.

You may also like
The Pair Trading Long strategy is part of Domenico D'Errico's pair trading system. By design, ...
The MomentumLE strategy generates a Long Entry signal when Momentum is rising. This strategy ...