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.

Related Topics:
What is VTS
System Requirements
Installing VTS
Main Menu
Property Window
Toolbox FUNCTIONS Pane
Welcome Screen
Expert Advisor Facts
Configure
Assignment
Condition
PLATFORM Function
Custom Indicators
TRADETIME Manager
TRADESIGNAL Manager
COMMUNICATION Manager
Message
Logic
Options
MetaTrader Platform Configuration
Compiler
Compiler Flags
Platform
Editor
EA Output Folder
Custom Indicator Folder
License
Package
fnOpenOrder
fnModifyOrder
fnCloseOrder
init and deinit
Getting Started
MetaTrader Platform
Journal Tab
Experts Tab
Expert Menu
MQL Help
Trade Tab
ECN Brokers
Step 1
Step 2
Step 4
Logic
Candlestick Function Parameters
Candlestick Drawing
Using Easy Email from the Communication Manager
Using Easy Email from any Element
Using Easy Email with the fnSendEzEmail Function
Testing the Easy Email Connection
Objects on the MetaTrader platform
Manually drawing a trend line
Removing a trend line
Building an Expert Advisor to draw and manage a trend line
Using FX PowerGrid
Script & Multi-Platform Plug-in
Building a MetaTrader Script
Using the Multi-Platform Feature
Using the Exit Plug-in
Using the Profit Manager
Client-Side Stops Plug-in
Emergency Stops
Using Client-Side Stops
Using an Offset Value
Using an Absolute Price Value
Objects on the MetaTrader Platform
Manually Drawing a Fibonacci Retracement
Removing a Fibonacci Retracement
Building an Expert Advisor to draw and manage a Fibonacci retracement
Signal Type: Element
Signal Type: Logic Condition
Configuring the Weight and Threshold
Using the Code Block Feature
EA-Indicator Plug-in
Enable the EA-Indicator Plug-in
Using the EA-Indicator Plug-in
Custom Indicators in the Toolbox
EA-Indicator Price Chart
EA-Indicator Video
Chart Objects Plug-in
fnDrawHorizontalLine
fnDrawVerticalLine
fnDrawArrow
fnDrawThumb
fnDrawLabel
fnDrawText
fnDrawCheckSign
fnDrawStopSign
Chart Objects on a MetaTrader Price chart
Adding Symbols
EA Secure Plug-in
Enbale the EA Secure Plug-in
EA Secure Plug-in System Manager
EA Secure Configuration
EA Secure on Price Charts
Chart Execute Plug-in
Chart Execute Configuration
Chart Execute on Price Chart
Using Chart Execute
Money Manager Plug-in
Money Management Table
Package Plug-in
Load a Package
fnRemoveAllPivots
Pivot Points on a MetaTrader Price Chart
fnFileRead
fnFileWrite
fnDeleteFile
Using the Multi Trade Plug-in
Multi Trade on a MetaTrader Price Chart
Using the Debug Manager Plug-in
Debug Manager Plug-in on a VTS Drawing
Event Manager Plug-in
Using the Event Manager
MQL Event Documentation