These kind of global variables are valid only in their program (EA,script,..).
Global variables of the terminal are set and used with these extra functions: https://www.mql5.com/en/docs/globals

- www.mql5.com
These kind of global variables are valid only in their program (EA,script,..).
Global variables of the terminal are set and used with these extra functions: https://www.mql5.com/en/docs/globals
Yes I know about terminal global variables, but is there any way of use them, but not allow user modify them?
include.mqh
then I use this include for different indicators, eas and scripts.
script 1
indicator 1
expert 1
If I initialize the variable from any code, ea for example,
expert 1
the variable value is not shared with the other indicators or scripts.
The only way to do this that I have found is to use global variables (GlobalVariableSet), but then they are created in the global variable system and can be modified by the user.
I don't want the user to be able to modify them.
Is there any system of global variables, other than using GlobalVariableSet?
Thank you
first get the global variable on OnInit
double value=GlobalVariableGet("value");
and save this value as a static variable in indicator or EA
static double svalue = value;
then check if its modified, keep checking on OnTick or OnCalculate
if(svalue !=GlobalVariableGet("name") ) { GlobalVariableSet("name","svalue"); }
it modified, set it again the value from static variable and force update Global variable, in this case even if user modified it will automatic update. I have not compiled, just written for reference
first get the global variable on OnInit
and save this value as a static variable in indicator or EA
then check if its modified, keep checking on OnTick or OnCalculate
it modified, set it again the value from static variable and force update Global variable, in this case even if user modified it will automatic update. I have not compiled, just written for reference
good idea, I'll try
Thanks

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
include.mqh
then I use this include for different indicators, eas and scripts.
script 1
#include <include.mqh>
indicator 1
#include <include.mqh>
expert 1
#include <include.mqh>
If I initialize the variable from any code, ea for example,
expert 1
the variable value is not shared with the other indicators or scripts.
The only way to do this that I have found is to use global variables (GlobalVariableSet), but then they are created in the global variable system and can be modified by the user.
I don't want the user to be able to modify them.
Is there any system of global variables, other than using GlobalVariableSet?
Thank you