Free Forex MQL Training
Free Forex, Candlestick Charts, and MetaTrader Training
| Global Variables Window - MetaTrader 4 |
|
| Written by Al Parsai | |
| Wednesday, 04 February 2009 | |
|
A Global Variable or or rather a GV is a special variable used by MetaTrader programs. Programmers use these variables in their Expert Advisors, custom Indicators, Scripts, and/or Libraries to keep track of events inside their programs. We use GVs because if you close MetaTrader or restart your computer you will not lose the value that the program assigned to them prior to the incident.
MetaTrader keeps the value of each GV for up to 4 weeks from the date of creation. The only data type that you can assign to a GV is a double number (or rather numbers with decimal places). If you are one of my MQL students you already know that we have two lessons and many examples that show you how to use GVs. If you would like to know more about my MQL course click here.
MetaTrader 4 exposes GVs to you through a window called Global Variables Window. To see this window from Tools menu select Global Variables. You may alternatively press F3.
Working with this window is fairly simple. The main area of the window shows you a list of existing global variables. You may see the last time they are updated and their current value.
If you wish to delete a GV select it from the list and then click Delete. Beware that this could interfere with the flow of an MQL program such as an Expert Advisor that you are using. Therefore before deleting any of the variables do your due deligence to avoid messing up with your programs.
You may even click Add and add a new variable. Such variable can later be used by your programs. You may raraly need to create a GV yourself. This is the job of your programs to take care of this task.
|
|
| Last Updated ( Wednesday, 04 February 2009 ) |
| < Prev | Next > |
|---|





