variable passing

 
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
 
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

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"
 
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.
 
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
Reason: