PC Set global variables

good

This article was : 

published

updated

On MetaTrader4 (MT4) / MetaTrader5 (MT5), you can set global variables, which are stored in MT4/MT5 itself independently of programs such as Expert Advisors (EA) and indicators. All programs running on MT4/MT5 can use the global variables.

Please note that these global variables set on MT4/MT5 are different from the usual global variables that are declared outside of functions in the source code of EA and indicators.

caution Stored for 4 weeks

The global variables for MT4/MT5 are stored for 4 weeks from the last access to MT4/MT5. Note that they will be deleted after 4 weeks of no access.

Here we will look at how to set global variables on MT4/MT5.

Switch between MT4/MT5 tabs to check the steps for each.

mt4
mt5

Step 1

Click "Tools" in the menu and select "Global Variables".

Open Global Variables Open Global Variables

Step 2

Add a global variable

To add a global variable, click "Add" and set the variable name and value.

Add a global variable Add a global variable

Edit a global variable

To edit a global variable, double-click the item you wish to change and edit the variable name or value.

Edit a global variable Edit a global variable

Delete a global variable

To delete a global variable, select the variable you wish to delete and click "Delete".

Delete a global variable Delete a global variable

Step 1

Click "Tools" in the menu and select "Global Variables".

Global variables Global variables

Step 2

Add a global variable

To add a global variable, click "Add" and set the variable name and value.

Add a global variable Add a global variable

Edit a global variable

To edit a global variable, double-click the item you wish to change and edit the variable name or value.

Edit a global variable Edit a global variable

Delete a global variable

To delete a global variable, select the variable you wish to delete and click "Delete".

Delete a global variable Delete a global variable

Was this article helpful?

thumb_down No
thumb_down Yes

0 out of 0 people found this article helpful.

Thank you for your feedback.

Send