Configure (Variable)


The Variable Configure Tab is used to set the data type and scope of a Variable.



Variable Type

A variable is used to store some useful information (or data).  Its type is defined by the kind of data that needs to be saved.

A datatype is simply a section of memory used to store a value.

The MQL data types are:

Integer (int): An integer is a whole number. A whole number means the number does not have a decimal point. For example, the number of total open trades is an integer: 0, 1, 2 . There is no concept of 1.5 open trades. However, the balance of a MetaTrader account is a number with a decimal point - such as 10,000.99. A number with a decimal point is called a real number in the field of mathematics. A real number data type is called a double in MQL.

Double (double): A double is a real number. A real number means the number has a decimal point. The balance of a MetaTrader account is a real number - such as 10,000.99.

Boolean (bool): A boolean is a data type that can one of two values: true or false.

String (string): A string is one or more characters. A string value is set using double quotes. For example: message=Hello World.

Void (void): A void type is a nothing type. It is used in to indicate that no data type is inferred.

Date and Time (datetime): A datetime data type is used to store calendar dates and times. The data type itself is actually an integer. The current time is an integer whose value is the number of seconds elapsed since midnight January 1, 1970. (This is a common approach, used in many computer languages, to define the current time.)

Color (color): A color data type is actually an integer type. This data type is defined to make color assignments easy.


Variable Scope

The word scope is used in programming to define the visibility of a data structure. That is, if a variable has global scope it can be accessed from anywhere within the program. If a variable has function scope it can only be accessed within the function that it is defined.

The levels of variable scope in VTS are:

extern: A extern variable is available as input to an Expert Advisor.

global: A global variable saves its value between Expert Advisor invocations.

system: A system variable is accessible from any function of an Expert Advisor.

function: A function variable is only accessible from the function where it is defined.

parameter: A parameter variable is used to send or receive data to or from a function. The variable is only accessible from the function where it is defined.  Note: a parameter variable can be set in Function Drawings only, not on the main system drawing.



Related Topics:
What is VTS
Why use VTS
System Requirements
Installing VTS
Main Menu
Toolbox FUNCTIONS Pane
Everything You Need To Know About VTS
Expert Advisor Facts
Configure
PLATFORM Function
Custom Indicators
MQL Function
TEXT Element
INPUT Manager
TRADETIME Manager
TRADESIGNAL Manager
COMMUNICATION Manager
OPENTRADE Manager
Message
Logic
MetaTrader Platform Configuration
Compiler
Compiler Flags
Platform
Editor
EA Output Folder
Custom Indicator Folder
Special Functions
fnOpenOrder
fnModifyOrder
fnCloseOrder
init and deinit
MetaTrader Platform
Journal Tab
Experts Tab
Expert Menu
MQL Help
Trade Tab
ECN Brokers
Step 2
Function and Logic Power Plug-in
Logic
Candlestick Plug-in
Candlestick Function Parameters
Candlestick Drawing
Using a Candlestick Function in a Logic Element
Easy Email Plug-in
Configure Easy Email Settings
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
TrendLine Plug-in
Objects on the MetaTrader platform
Manually drawing a trend line
Removing a trend line
Building an Expert Advisor to manage a manually drawn trend line
Building an Expert Advisor to draw and manage a trend line
Grid Plug-in
FX PowerGrid Functions
Grid Main Settings
fnRemoveLines
Using FX PowerGrid
Script & Multi-Platform Plug-in
Building a MetaTrader Script
Using the Multi-Platform Feature
Profit Exits Plug-in
Profit Manager Plug-in
Target
Action
Price Chart
Client-Side Stops Plug-in
Emergency Stops
Using Client-Side Stops
Fibonacci Trader Plug-in
Objects on the MetaTrader Platform
Manually Drawing a Fibonacci Retracement
Removing a Fibonacci Retracement
Building an Expert Advisor to manage a manually drawn Fibonacci retracement
Building an Expert Advisor to draw and manage a Fibonacci retracement
Signal Aggregator Plug-in
Signal Type: Element
Signal Type: MQL
Signal Type: Logic Condition
MQL-Mentor Plug-in
Using the Code Block Feature
Partial-Close Plug-in
Partial-Close Price Chart
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
Market Score Plug-in
Adding Symbols
Order History Plug-in
EA Secure Plug-in
EA Secure Configuration
Chart Execute Plug-in
Chart Execute Configuration
Chart Execute on Price Chart
Using Chart Execute
Chart Execute Notes
Money Manager Plug-in
Money Manager Configuration
Money Management Table
Package Plug-in
Pivot Points Plug-in
Using the Pivot Point Plug-in
Pivot Points on a MetaTrader Price Chart
File IO Plug-in
fnFileRead
fnFileWrite
fnDeleteFile
Multi Trade Plug-in
Multi Trade on a MetaTrader Price Chart
Debug Manager Plug-in
Using the Debug Manager Plug-in
Event Manager Plug-in
MQL Event Documentation