How to Use a Custom Indicator in the VTS EA Builder

Most Custom Indicators can be used in the VTS EA Builder, including the Knoxville Divergence custom indicator.

Rob Booker’s MT4 Knoxville Divergence custom indicator can be used in VTS just like any other MetaTrader built-in indicator.   You just have to configure the indicator so that VTS knows how it is used.

There is one very important point. VTS uses the name of the custom indicator to create some variable names within the generated MQL code.   So there will be problems if the custom indicator name has any strange characters.  Normally, I’ll change the name of custom indicator so that it has no special characters and no spaces. for example, I changed:

Knoxville Divergence v3.5.ex4


 Knoxville Divergence.ex4

I removed the period.  This is as easy as changing the file name.  Changing the name of the EX4 file has no effect on the  custom indicator and does not require a rebuild.

In VTS, I used the Custom Indicator Analyzer (CIA) wizard to discover how the  Knoxville Divergence custom indicator draws lines on the price chart. 

A custom indicator can draw up to 8 lines on a chart.  For the Knoxville Divergence custom indicator,  I discovered that when an Up arrow is drawn, a price value is written to line 2 (also called “mode” or “buffer” 2), otherwise, the MQL built-in value EMPTY_VALUE is written to the line 2.

And,  I discovered that when a Down arrow is drawn, a price value is written to line 3 (also called “mode” or “buffer” 3), otherwise, the MQL built-in value EMPTY_VALUE is written to the line 3.

With this information, we can configure the Knoxville Divergence custom indicator in VTS so that it can be used just like any other MetaTrader built-in indicator.

When we define a custom indicator we tell VTS about the input parameters (so it can be configured in VTS) and the output parameters, so we can use the “mode” to select the Line value we want from the custom indicator.

The first time you click the (+) button of a custom indicator on the VTS drawing pad, you are prompted to configure the indicator. (To edit the configuration at anytime, click the (?) button).

This is what the configuration window looks like in VTS:

Here is an old video showing how to configure a custom indicator:

The result of configuring the indicator creates a simple text file that holds the info. This is what it looks like:






















 With the Knoxville Divergence custom indicator defined, it can now be used in VTS like any other indicator. 

Note, for indicators that display more than one line, the “mode” parameter is used to select which line you would like the value for. In this image, the mode is selected as KNOXVILLE_DIVERGENCE_ARROW_UP:

The Knoxville Divergence can be used within a Logic Element in VTS:

For more information, watch this in-depth video that shows how to use the Custom Indicator Analyzer wizard to configure the Hull Moving Average Custom Indicator:


Also, here is the link to the VTS help doc:


It was pretty tedious to enter all of the input parameters for Knoxville Divergence, so I included the Indicator Descriptor File (IDF) so you don’t have to configure it. Just download, unzip and copy the IDF file to:

C:\Program Files (x86)\iExpertAdvisor\Visual Trader Studio Connect\cfg\idfs

Make sure the name of the IDF file matches the name of the indicator found in your MetaTrader platform. (Remember, I changed the name of the EX4 file).

Download the IDF:  knoxville-divergence

To get notified about the latest questions and answers, follow us!