GlobalVariableSet(StringConcatenate(Symbol(),"_myvarname"), whatever_value_I_assign_here);
Hi TheEconomist,
Thank you very very much
Regards
Paulo
Symbol() returns the name of the pair on the chart the indicator/script/EA is attached to
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi there.
I am new to mql4 programming and been read some books and tutorials but the easiest way to get the things done is with your precious help.
I need to create a variable (in fact a global variable) that is based on symbol where the indicator is attached.
That way I will be able to use the indicator in several pairs without having to re-code the indicator for each pair.
The idea is:
- Create/Check/Set value of a variable based on currency symbol.
For instance: The indicator is on EUR-USD pair.
The indicator code creates a global variable named "PAIR"_variable_name. In this case EURUSD_variable_name.
If attached on USD-CHF, should be "PAIR"_variable_name. In this case USDCHF_variable_name.
Thank you very much
Regards
Paulo