Getting Started with Divergence Analyst

Loading Divergence Analyst onto a Chart

1. Open a chart

Since all of the chart templates I have included in the ‘TTP Divergence Analyst Essentials’ installer are in subfolders within the \Documents\NinjaTrader 8\templates\Chart\DivergenceAnalyst folder, none of them will be selectable when opening a new chart. You will have to apply a chart template after the chart has already been created.

Graphical user interface, text, application

Description automatically generated

2. Load a chart template

Diagram

Description automatically generated

Graphical user interface, text, application

Description automatically generated

You can select from the many chart templates as a starting point or manually add the Divergence Analyst indicator to the chart.

Graphical user interface

Description automatically generated

3. Add the Divergence Analyst to a chart

Diagram

Description automatically generated with medium confidence

Graphical user interface, diagram, text

Description automatically generated

You can then either [A] load an indicator template as a starting point, or [B] start from scratch and go through all of the properties yourself. I recommend you study all the various parameters and filters at length, modifying each and then seeing the differences in the divergence patterns. When you hover your cursor over the display name of a property, you will see the tooltip description. However, the tooltips will pop up for only five seconds, so you may have to take a screenshot of them after they appear or refer to the articles on the different sections of properties within the documentation on the site: https://tradetheplan.com/documentation/divergence-analyst

The more time you spend making changes and analyzing the outcome of those changes, the faster you will learn all the ins and outs of the Divergence Analyst. For me, at least, the fastest way to learn a new indicator is to test various settings for each parameter.

Graphical user interface, text, application, chat or text message

Description automatically generated

There are many Divergence Analyst indicator templates to choose from as a starting point. Select one, click ‘Load’ to add it, and see the results.

Graphical user interface, text

Description automatically generated

Modifying the Divergence Component

To set or change the attached indicator or instrument used as the ‘Divergence Component,’ you must open the ‘Divergence Component Selector UI’ (a pop-out window from which to load the divergence component and modify its properties).

  • Click the radio button (checkbox) to the right of the ‘Divergence Component <open selector>’ property to open the window.

Graphical user interface, text, application

Description automatically generated

The features within this ‘Selector UI Window’ enable the Divergence Analyst to load any indicator or instrument to compare against the base instrument and solve various divergence patterns.

Selecting the Appropriate ‘Input’ and ‘Render’ Options

Divergence Analyst has five different ‘Input’ options, each with its own set of ‘Render’ options. Each ‘Render’ option has its own set of related properties. For most selected indicators, the default option of ‘Indicator – one value’ will be the desired input.

Note: Keep the following in mind as you read through this section: To find divergence patterns, the ‘Selected divergence component’ is compared against the ‘Price component.’ The ‘Price Component’ sets the input used by the SwingTrend algorithm that is built into the Divergence Analyst for identifying swing highs and lows. The identified swing highs and lows are compared against the Divergence Component’s Used Series to solve for the various divergence patterns. The SwingTrend has five options to choose from for its price input series: [1] HighLow, [2] Close, [3] Median, [4] Typical, and [5] Weighted. HighLow is set by default.

The following is the list of the five ‘Input’ options:

  1. Indicator – one value
  2. Indicator – HL value
  3. Indicator – OHLC values
  4. Instrument – HL component
  5. Instrument – one component

Indicator – one value

When using indicators such as the MACD, Stochastics, RSI, TSI, etc., one of the plots will be set as the ‘Used series’ and so ‘Indicator – one value’ should be selected as the Input option. For the vast majority of indicators, ‘Indicator – one value’ will be set as the Input, as one plot (or one data series value) will be set as the ‘Used series’ to compare against the price component (SwingTrend).

The ’Render’ option sets how the Divergence Analyst will draw the Divergence Component. The ‘Indicator – one value’ Input option has two ‘Render’ options:

  1. Show original plots – will draw all plots from the ‘Used indicator’
  2. No render – will not draw any of the plots from the ‘Used indicator’ but will still draw the enabled divergence and swing trend drawing objects on the price panel. The ‘No render’ option is used only when the user desires to completely hide the indicator panel and sets the Divergence Analyst’s ‘Panel’ to the ‘Same as input series’ option (see image below).

  • To select an indicator, click on the first dropdown property under INPUT PROPERTIES named ‘Used indicator’ and select the desired indicator from the list.

Graphical user interface, text, application

Description automatically generated

The following image shows all of the properties when ‘Indicator – one value’ is set as the ‘Input’ and ‘Show original plots’ is sets as the ‘Render’ option with the TTP RSI Gapless set as the ‘Used indicator:’

Graphical user interface

Description automatically generated

*Note: You can add overbought/oversold levels (and a midline, if needed) via the main properties grid under 4. Divergence Drawing Objects.

Indicator – HL value

The ‘Indicator – HL value’ Input is one that may be rarely used. However, as the goal for the Divergence Analyst has been to find all types of divergence patterns between price and any instrument and any indicator, we have made allowances for even the rarest of use-cases. One case for the ‘Indicator – HL value’ Input option would be to use a Cumulative Delta indicator as the ‘Used indicator’ and draw the delta plot as a simple HiLo bar. Another case would be to use a custom-built oscillator that would use the high of the bars as the input for one plot and the low of the bars for the input of another plot, then you could use the high plot as the ‘Used series for High values’ and the low plot as the ‘Used series for Low values.’

The ‘Indicator – HL value’ Input option has three ‘Render’ options:

  1. Show original plots – will draw all plots from the ‘Used indicator’
  2. HL bars – will draw HighLow bars between the ‘Used series for High values’ and ‘Used series for Low values’
  3. No render – will not draw any of the plots from the ‘Used indicator’ but will still draw the enabled divergence and swing trend drawing objects on the price panel.

The image below is using NinjaTrader’s ‘Order Flow Cumulative Delta’ indicator as the ‘Used indicator’ in the Divergence Analyst with ‘HL bars’ set as the Render option.

The following image shows the settings for the chart above:

Graphical user interface, text, application

Description automatically generated

Delta High must be set as the ‘Used series for High values’ and Delta Low must be set as the ‘Used series for Low values.’

The dropdown for ‘Indicator properties’ at the bottom of the list of INPUT PROPERTIES will reveal all of the main options and parameters for the ‘Used indicator’ (Order Flow Cumulative Delta, in this case).

Graphical user interface, text, application

Description automatically generated

As ‘HL bars’ is set as the Render method, the ORIGINAL PLOTS properties are disabled. The RENDER PROPERTIES are used, instead, to set the colors for the Up and Down bars. The ‘Upcolor’ and ‘Downcolor’ can be ‘Inherited’ from the indicator, but the Cumulative Delta yields only Lime for the color, so the colors need to be set manually.

Note: Since the ‘Indicator – HL value’ draws only one object for the HL bars instead of the three objects required to draw candlesticks, ‘Indicator – HL value’ would be a good alternative to use with Cumulative Delta, if NinjaTrader 8 ever gets a bit bogged down due to running too many instances of Order Flow-type indicators (or just excessive CPU usage, in general).

Indicator – OHLC value

If you’d like to add Cumulative Delta as the Divergence Component, the ‘Indicator – OHLC value’ Input is a better option than ‘Indicator – HL value.’

The ‘Indicator – OHLC value’ Input option has five ‘Render’ options:

  1. HL bars – will draw HighLow bars between the ‘Used series for High values’ and ‘Used series for Low values’
  2. HLC bars – will draw HighLowClose bars using the set ‘Used series …’ options
  3. OHLC – will draw OpenHighLowClose bars using the set ‘Used series …’ options
  4. Candlesticks – will draw Candlesticks using the set ‘Used series …’ options
  5. No render – will not draw any of the plots from the ‘Used indicator’ but will still draw the enabled divergence and swing trend drawing objects on the price panel.

The image below is using NinjaTrader’s ‘Order Flow Cumulative Delta’ indicator as the ‘Used indicator’ in the Divergence Analyst with ‘Candlesticks’ set as the Render option.

Chart, histogram

Description automatically generated

The following image shows the settings for the chart above:

You can see in the image above that, after the ‘Used indicator’ property is set to ‘Order Flow Cumulative Delta,’ the following ‘Used series …’ input properties are set to their corresponding plots/series:

  1. Used series for Open values is set to Delta Open
  2. Used series for High values is set to Delta High
  3. Used series for Low values is set to Delta Low
  4. Used series for Close values is set to Delta Close

The dropdown for ‘Indicator properties’ at the bottom of the list of INPUT PROPERTIES will reveal all of the main options and parameters for the ‘Used indicator’ (Order Flow Cumulative Delta, in this case).

Graphical user interface, text, application

Description automatically generated

As Candlesticks is set as the Render method, the ORIGINAL PLOTS properties are disabled. The RENDER PROPERTIES are used, instead, to set the colors for the Candlesticks. The ‘Upcolor’ and ‘Downcolor’ can be ‘Inherited’ from the Chart’s data series, but the ‘Candle wick’ and ‘Candle body’ must be manually set.

Select the ‘Used series’ (or plot) to be used as the divergence component.

The indicator’s periods, colors, widths, and dash styles must be set from this UI window via the ‘Indicator properties’ dropdown at the bottom of the INPUT PROPERTIES header.

*Note: You can add overbought/oversold levels (and a midline, if needed) via the main properties grid under 4. Divergence Drawing Objects.

Instrument – HL component

The ‘Instrument – HL component’ Input method allows you to pull any instrument from any ‘Instrument list’ to set as the Divergence Component. Remember though, that you must already have the desired instrument within one of the instrument lists to be able to select it from the dropdowns. When ‘Instrument – HL component’ is selected, the algo will automatically set the appropriate data points to generate the selected Render method from the price component data points of the ‘Used instrument:’ Highs for bearish divergence, Lows for bullish divergences. All you have to do, then, is decide which render method to use and what colors to set for the bars or candlesticks.

Note: When adding indices as the ‘Used instrument’ – such as ^ADD and ^TICK – you will most likely want to use the RTH Trading Hours template (Regular Trading Hours). When the chart is set to the RTH session, you may notice that the visual display of the added instrument’s candlesticks does not align with the divergence trendlines in the indicator panel. For some reason (unbeknownst to us), NinjaTrader randomly gets the timestamps for the added instrument out of sync with the base instrument. The only way to get around the issue is to either add the secondary instrument to the chart (from the chart’s ‘Data Series…’ window) or to enable the ‘Needs time sync’ property shown in the image below.

Graphical user interface, text, application

Description automatically generated

The ‘Instrument – HL component’ Input option has five ‘Render’ options:

  1. HL bars – will draw HighLow bars between the ‘Used series for High values’ and ‘Used series for Low values’
  2. HLC bars – will draw HighLowClose bars using the set ‘Used series …’ options
  3. OHLC – will draw OpenHighLowClose bars using the set ‘Used series …’ options
  4. Candlesticks – will draw Candlesticks using the set ‘Used series …’ options
  5. No render – will not draw any of the plots from the ‘Used indicator’ but will still draw the enabled divergence and swing trend drawing objects on the price panel.

Instrument – one component

The ‘Instrument – HL component’ Input method allows you to pull any instrument from any ‘Instrument list’ to set as the Divergence Component. Remember though, that you must already have the desired instrument within one of the instrument lists to be able to select it from the dropdowns. When ‘Instrument – HL component’ is selected, the algo will automatically set the appropriate data points to generate the selected Render method from the price component data points of the ‘Used instrument:’ Highs for bearish divergence, Lows for bullish divergences. All you have to do, then, is decide which render method to use and what colors to set for the bars or candlesticks.

The ‘Instrument – HL component’ Input option has six ‘Render’ options:

  1. Line on component – will draw a line on the selected ‘Used price component’
  2. HL bars – will draw HighLow bars between the ‘Used series for High values’ and ‘Used series for Low values’
  3. HLC bars – will draw HighLowClose bars using the set ‘Used series …’ options
  4. OHLC – will draw OpenHighLowClose bars using the set ‘Used series …’ options
  5. Candlesticks – will draw Candlesticks using the set ‘Used series …’ options
  6. No render – will not draw any of the plots from the ‘Used indicator’ but will still draw the enabled divergence and swing trend drawing objects on the price panel.

Chart, histogram

Description automatically generated

Set the ‘Input series’

Indicators use one data point from the price bar as the input series from which the indicator’s plots and series are built. The closing price is the default Input series for indicators, so you may want to consider changing from the closing price as the Divergence Analyst ‘Input series’ to something like the median or typical price. When loading an instrument into the divergence analyst, the ‘Input’ property (at the top of the ‘Divergence Component Selector UI’ window) governs the set ‘Input series.’

Graphical user interface, application

Description automatically generated

Graphical user interface

Description automatically generated

Graphical user interface

Description automatically generated

Select the ‘Price component’

To find divergence patterns, the ‘Selected divergence component’ is compared against the ‘Price component.’ The ‘Price Component’ sets the input used by the SwingTrend algorithm that is built into the Divergence Analyst for identifying swing highs and lows. The identified swing highs and lows are compared against the Divergence Component’s Used Series to solve for the various divergence patterns.

The SwingTrend identifies and marks (if drawing objects are enabled) three different sizes of swings from the price bar data – Major, Intermediate, and Minor swings – that the Divergence Analyst compares against the Divergence Component to check for divergence patterns.

Graphical user interface, text, application

Description automatically generated

The SwingTrend has five options to choose from for its price input series: [1] HighLow, [2] Close, [3] Median, [4] Typical, and [5] Weighted. The default is set to HighLow, which uses the highs and lows of the bars (two data points per bar) to mark the swing points. ‘Close’ uses the closing prices only (one data point per bar) to mark swing points. ‘Median’ uses the midpoint of the bars (one data point per bar [(High+Low) / 2]) to mark the swing points. ‘Typical’ uses the [(High+Low+Close) / 3] of the bars (one data point per bar) to mark the swing points. ‘Weighted’ uses [(Open+High+Low+Close) / 4] of the bars (one data point per bar) to mark the swing points. The default setting is HighLow, which compares the price bars’ highs for bearish divergences and the price bars’ lows for bullish divergences. The Close, Median, Typical, and Weighted options use only one data-point per bar to compare both bullish and bearish divergences, but since the Divergence component has just one input series (see above for setting the input series), using one of these four options and matching it to the input series may yield more precise regular-divergence signals that better reflect accurate, waning momentum patterns. However, divergence patterns that you can spot with your eye may not necessarily meet the conditions for a precise divergence signal and would therefore not be found, leading to confusion and frustration. I keep mine set to HighLow, for the most part, as identifying the pattern in the price structure – the lower low after a minimum retracement and higher high after a minimum retracement – is more important to me than requiring a more precise set of conditions but then missing a significant percentage of patterns that are not signaled. However, many will want to modify these values and identify only those patterns that truly meet all of the waning momentum conditions for regular divergence patterns.

*Important Note: In previous versions of the Divergence Analyst, identifying divergence patterns in real-time was possible only with the HighLow option set for the Price Component. The other four options needed the bar to close before divergence patterns could be found. However, as our development skills have improved, our tools have too. The Divergence Analyst can now solve for divergence patterns in real-time with any of the Price Component input options selected.

Allow me to explain briefly. With the HighLow setting, real-time signal generation is easily achievable because, for any given bar, a bar’s high can only get higher – it can never have a high which would be lower by the time the bar finished building. Vice versa for a bar’s low. This may seem rather obvious. However, when the median, typical, weighted, or closing price of a bar is used as the input for the SwingTrend, that price can be higher or lower by the time that bar closes. As a bar is building in real-time, its current price is treated as its closing price. The median price of a bar is its midpoint, which value can change as the range of the bar increases, moving lower if the bar’s low moves down or higher as the bar’s high moves up. The typical price depends on both the final closing price and the final range of the bar. The weighted price depends on the last closing price, the final range of the bar, and its open.

I wrote the following in a previous version of this guide before a solution was implemented in the code:

Solving for divergence patterns in real-time with these single-data-point-per-bar price inputs would require back-painting or repainting the signals, and no quality indicator should do either of these things.

However, that was not an entirely accurate statement. We were, in fact, able to find a solution to this real-time divergence calculation issue by implementing a ‘virtual bar’ algorithm that would allow the Divergence Analyst to find divergence patterns, in real-time, using Close, Median, Typical, or Weighted as the Price Component input. If you use Close, Median, Typical, or Weighted as the Price Component input and watch the divergence setups found in real-time, you will eventually see how a divergence setup that is on the verge of being canceled (no longer meets all the required parameters and filters) will be removed from the chart (no longer drawn) as the divergence is canceled and then redrawn once the conditions are met again, all intra-bar.

Select the ‘Parameters and filters preset’

Select from one of the 22 indicators’ presets associated with the ‘Selected Divergence Component.’ Various oscillators are built with many different methods, variables, and lookback periods, and each requires unique settings for the many parameters and filters available within the Divergence Analyst properties grid. Changing from one preset to the next will modify many regular and hidden divergence setup parameters. However, these default preset parameters may be too strict, producing fewer divergence signals than expected, so please familiarize yourself with the many parameters and filters that determine which divergences will be found to set up your Divergence Analyst accordingly. Each preset can serve as a starting point to fine-tune the many different parameters and filters.

A picture containing table

Description automatically generated

I have included several oscillators with the Divergence Analyst that you are welcome to test. The last two in the list below – the Universal MACD and the Universal Oscillator – are pretty unique and capable of creating many new variations of several oscillator-type indicators.

[TradeThePlan] 310 Oscillator
[TradeThePlan] Awesome Oscillator
[TradeThePlan] Balanced Momentum
[TradeThePlan] Balanced Momentum Normalized
[TradeThePlan] Derivative Oscillator
[TradeThePlan] Directional Trend Index
[TradeThePlan] MACD
[TradeThePlan] MACD BB Lines
[TradeThePlan] MACD Gapless
[TradeThePlan] MACD Normalized
[TradeThePlan] MACD Normalized Gapless
[TradeThePlan] MFI
[TradeThePlan] PPO
[TradeThePlan] RSI Gapless
[TradeThePlan] Slow RSI
[TradeThePlan] Stochastic Momentum Index
[TradeThePlan] Stochastics
[TradeThePlan] TSI
[TradeThePlan] Universal MACD
[TradeThePlan] Universal Oscillator

Like this article?