Function Parameter Values
The parameter values that appear in the "Chart Execute" window may look different than the parameter values you see in VTS. The values will often appear as their actual numerical value.
For example, for the timeframe parameter, instead of the value PERIOD_M30, you will see the value 30. If you are not familiar with the actual values of many of the MQL predefined variables (and most traders are not), it may be better to configure the function in VTS and run the function with the same values in "Chart Execute". By default, the parameters values in "Chart Execute" exactly match the parameter values in VTS, so if you don't change them, they will be the same.
Remember, VTS is full-featured Windows application and is able to present MQL predefined variables as though they are part of VTS. "Chart Execute" is a light-weight application that is built on the fly when you build your EA, therefore the presentation is not as rich.
Function Testing
Use the "Run Once" option to test your functions for the first time.
When the function is executed, all of the parameters values and the return value of the function are displayed in the "Experts" Tab on the bottom of your MetaTrader terminal window.
(Note: If the terminal window does not appear on the bottom of your MetaTrader platform, in your MT platform, go to View.>Terminal).
Using a VTS Drawing to Hide Function Parameters
Many times you may not want to change any parameters of a function, or perhaps just one or two parameters, but viewing them all is a distraction.
One method to hide the function parameters, so they do not become a distraction, is to create a new VTS Drawing with just a Start Element, the function you want to execute and an End Element.
Once the drawing is attached (see Connecting Functions on a Drawing below), and enabled in Chart Execute, the function "MyAdx" (the name of the drawing) will appear in the "Chart Execute" function list. And the "MyAdx" function will not have any parameters. It will simply execute the drawing above, including iADX3, with the parameters that are defined in the iADX3 function.
If you know you are always going to execute a function with the same parameters, this is an excellent way to insure no mistakes are made when the function is executed.
If you want the ability to change just one (or more) parameters of the iADX function, this can be done by adding a Variable Element (of scope Parameter) to the drawing, and the using the variable in the ADX function.
For example, create a Variable named "MyPeriod", set the scope to parameter and add it to the Drawing.
When configuring the ADX function, set the period Parameter to "MyPeriod".
Using this method, when the "MyAdx" function is displayed in "Chart Execute", the only parameter to appear will be "MyPeriod".
Connecting Functions on a Drawing
In order for a function to be displayed in "Chart Execute", it must be connected on a Drawing in the VTS System.
There may be a situation where you want a function to be available in "Chart Execute", but the function is not needed in your EA. For this situation, you can connect the function an output of a Logic Element that will never evaluate to true, and therefore will never execute within the EA.
For example, create a Logic Element with a logic condition of "1 is equal to 2". This condition will never evaluate to true.
Connect the function to be used only by "Chart Execute" to the True output of the Logic Element. The rest of the (useful) Elements required by the EA can be connected to the False output, where they will execute normally when the EA runs.
In the below Drawing, the MyADX function is connected to the True output of Logic1. The only condition within Logic1 is:
"1 is equal to 2"
which will never execute within the EA, but the MyADX function will be available to execute in "Chart Execute".
This technique of creating Drawing functions to hide the parameters is especially useful for trading operations such as opening, closing and managing open trades. The MQL functions Ordersend, OrderModify and OrderClose have many parameters that most traders do not have a need to change when executing.