4 Using Custom Indicators in A VTS System
4 Using Custom Indicators in A VTS System
• Any indicator found in the custom indicator folder will be available for
selection from the VTS Function’s Toolbox under the menu “Custom
Indicators”.
• NOTE: If the folder “Custom Indicators” is not shown from within the VTS
Functions Toolbox tab, it most likely because the MetaTrader tools
directory has not yet been configured. The best way to configure the
MetaTrader tools directory is to build a VTS system: From the Welcome
Page, click Start New -> QuickStart EA and press “Build”. If the
MetaTrader tools directory is not set you will be prompted.
• To make your custom indicator available for selection from the VTS
Toolbox, simply copy the custom indicator file into the custom indicator
folder.
• The first time a custom indicator is dragged from the VTS Toolbox to the
VTS drawing pad, the user will be prompted to define the custom
indicator’s Input Variables and Output Lines.
• Many VTS users do not have the MQL source code for their custom
indicators; therefore it is necessary to manually enter the custom
indicator’s Input Variables and Output Lines.
• Open the MetaTrader platform and attach the custom indicator ZigZag to
any price chart. (From the Navigator window of the MetaTrader platform,
expand “Custom Indicators” menu and double-click “ZigZag”.)
• When the indicator is attached to the price chart the following window,
called the “Indicator Configuration” window, will appear. Leave this
window open to help when entering the custom indicator’s Input Variables
and Output Lines into VTS.
• Select the Functions Toolbox Tab and expand the “Custom Indicators”
menu.
• NOTE: If the folder “Custom Indicators” is not shown from within the
VTS Functions Toolbox tab, it most likely because the MetaTrader
tools directory has not yet been configured. The best way to configure
the MetaTrader tools directory is to build a VTS system: From the
Welcome Page, click Start New -> QuickStart EA and press “Build”. If
the MetaTrader tools directory is not set you will be prompted.
• The first time the “ZigZag” custom indicator is dragged onto the
drawing pad, the “Custom Indicator Definition” window is shown.
• Note, the input variables for your custom indicator are best identified
from the “Indicator Configuration” window shown when attaching the
indicator to a MetaTrader price chart. Select the “Inputs” tab to view
the inputs.
• Repeat this procedure for the other input variables “ExtDeviation” and
“ExtBackstep”.
• The “Indicator Configuration” window for the “ZigZag” indicator shows one
output line: “Red”.
• To define the “Red” output line in VTS, return to the “Custom Indicator
Definition” window and select the “Add Output Line” button. The
“Custom Indicator Line Definition” window will be shown.
• Enter the value Red into the Line Name field and select OK.
• The “Output Lines” appear as selection items for the “mode” parameter.
• Note, after making changes to the custom indicator definition, remove the
element from the drawing and drag and drop another copy to view the new
changes.
double iCustom(string symbol, int timeframe, string name, ..., int mode, int shift)
Calculates the specified custom indicator and returns its value. The custom indicator must be compiled (*.EX4 file) and be in the
terminal_directory\experts\indicators directory.
Parameters:
symbol - Symbol the data of which should be used to calculate indicator. NULL means current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
name - Custom indicator compiled program name.
... - Parameters set (if necessary). The passed parameters and their order must correspond with the
desclaration order and the type of extern variables of the custom indicator.
mode - Line index. Can be from 0 to 7 and must correspond with the index used by one of SetIndexBuffer
functions.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of
periods ago).
Sample:
double val=iCustom(NULL, 0, "SampleInd",13,1,0);
• What makes the iCustom function difficult to use is the fourth parameter.
The ellipsis (…) indicates there can be zero to N number of parameters
defined. The number depends on the specific custom indicator.
• The mode parameter is used to get the value of the specific line output of
the custom indicator. Many indicators have more than one line drawn on
the chart. This value must be defined correctly to receive the value of the
correct line.