Whitebox Strategy Engine ยป Divergence Settings


Overview

Certain strategy scripts (for example The Architect) have divergences as part of their entry criteria.

To allow strategies use divergences as part of their entry criteria, you will need to add The Divergent (Pro) divergence indicator to your chart, and "link" it to the strategy. (The Divergent (Pro) indicator is included in your Whitebox subscription).

Once the strategy and The Divergent (Pro) is all linked up, the strategy is ready to use divergences as part of its entry criteria.

You may wonder: Why wasn't divergence detection built into the strategies?

Two reasons:

  1. The code for detecting divergences is quite long and would not fit into the code size limitations imposed on strategy scripts
  2. We don't have to maintain several instances of the same divergence detection code in the various strategies

While this makes it slightly more complicated to use strategy scripts with divergences, this was the only way we could implement this functionality.

In this tutorial will not go into detail on what divergences are, or how to use The Divergent (Pro) indicator. To learn more about divergences and The Divergent (Pro) indicator please visit https://thedivergent.io.

Settings

Strategies that support divergences, will have a Divergence Settings section as part of their settings:

Divergence Settings

The settings here isn't about configuring how divergences are detected, but instead how the divergences detected by The Divergent (Pro) indicator is used by the strategy. To change the logic of how divergences are being detected, you will need to open the settings of The Divergent (Pro) indicator itself.

Let's review these settings input by input.

Enable Divergence Detection

If enabled, the strategy will use divergences as part of its entry criteria.

Divergence Indicator Link

To make divergence detection work, you will need to link the strategy to the The Divergent (Pro) indicator.

Steps to link the indicator to the strategy:

  1. Add The Divergent (Pro) indicator to your chart
  2. Select The Divergent (Pro): Divergence Signal in the Divergence Indicator Link dropdown

If you have linked the indicator to the strategy, but cannot see any divergence lines being drawn on the price chart, please try disabling divergence detection using the checkbox above, and try enabling it again.

Display Link Status

If enabled, a panel showing the "link" status of the divergence indicator will be displayed at the bottom left corner of the chart.

Display Divergence Lines on Price Chart

If enabled, the divergence lines will be displayed on the price chart.

Please note that if you have Pivot Correction enabled in the divergence indicator, the divergence line will be plotted on the corrected pivot on the price chart. Furthermore, if Pivot Correction is enabled, the strategy will use the corrected pivot as the divergence's starting and ending point for Divergence Validity (please see below).

Divergence Validity

The number of bars a divergence is considered valid for (i.e. how many bars should the strategy treat a divergence as still 'relevant' following the bar on which the divergence was detected).

Note: The bars are counted from the end point of the divergence, and not from the bar on which the divergence was confirmed. This means that if the Divergence Indicator's 'Pivot Lookback Right' is set to 4, and the validity is set to 5, that will result in the divergence being valid for 5 - 4 = 1 bar after it was detected.

Check Validity On

Select which divergence line should the strategy look at when determining if a divergence is still valid.

This only really makes a difference, when you have Pivot Correction enabled in the divergence indicator. When Pivot Correction is enabled, the divergence line drawn on the oscillator and the price may not line up exactly. If you select the oscillator here, the strategy will use the ending point of the divergence line drawn on the oscillator to calculate the distance. If you select the price, the strategy will use the ending point of the divergence line drawn on the price chart to calculate the distance.

Long Entry Divergence Prerequisite

The type of bullish divergence to use as the prerequisite of a long entry.

Short Entry Divergence Prerequisite

The type of bearish divergence to use as the prerequisite of a short entry.