Hi, does anyone know if you can pass variables between functions, other than using the GlobalVariable stuff? I would like a function to return 8 variables.
Thanks
Mark
Thanks
Mark
I do not see why would you want to do that but only way I know would be to use StringConcatenate() and than split the string.
If function is not in library You can pass parameters by reference. Or in other case You can pass some array by reference.
See "MQL4: Formal parameters"
See "MQL4: Formal parameters"
actually, what I want to do is pass 8 variables back to the main prog that calls this function. Is it possible to have the function return an array as compared to an int? Then I could send as many items as desired.
Why don't you use variables declared at global level in your main prog : your func can modify them and then your main prog may use the modified ones ?
As I mentioned in my first post, I don't want to use GlobalVariables. Mainly because each currency pair will call this function, and there is a risk of crossing data between variables. Other than giving each CP its own global ... but that just get's messy.
As I mentioned in my first post, I don't want to use GlobalVariables. Mainly because each currency pair will call this function, and there is a risk of crossing data between variables. Other than giving each CP its own global ... but that just get's messy.
I believe Slawa answered your question when he said you can pass parameters by REFERENCE.
-charliev
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Thanks
Mark