RAQ

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

 to:

 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:

FILE_NAME=KnoxvilleDivergence

INPUT_PARAMETER=CandlesBack,Integer,30

INPUT_PARAMETER=RSIPeriod,Integer,21

INPUT_PARAMETER=MomentumPeriod,Integer,20

INPUT_PARAMETER=FastMAPeriod,Integer,12

INPUT_PARAMETER=SlowMAPeriod,Integer,26

INPUT_PARAMETER=SignalMAPeriod,Integer,9

INPUT_PARAMETER=KPeriod,Integer,70

INPUT_PARAMETER=DPeriod,Integer,10

INPUT_PARAMETER=Slowing,Integer,10

INPUT_PARAMETER=Stochastic_Upper,Integer,70

INPUT_PARAMETER=Stochastic_Lower,Integer,30

INPUT_PARAMETER=Reversal_Tabs_Alerts,Boolean,false

INPUT_PARAMETER=Mail_Alert,Boolean,false

INPUT_PARAMETER=PopUp_Alert,Boolean,false

INPUT_PARAMETER=Sound_Alert,Boolean,false

INPUT_PARAMETER=SmartPhone_Notifications,Boolean,false

OUTPUT_LINE=KNOXVILLE_DIVERGENCE_NO_DATA_0

OUTPUT_LINE=KNOXVILLE_DIVERGENCE_NO_DATA_1

OUTPUT_LINE=KNOXVILLE_DIVERGENCE_ARROW_UP

OUTPUT_LINE=KNOXVILLE_DIVERGENCE_ARROW_DOWN

 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:

https://youtu.be/6XXT77z3MJM

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

http://www.iexpertadvisor.com/connect-help/html/index.html?customindicators.html

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!