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
Here is a simplified explanation -> https://www.mql5.com/en/forum/117210. Arrays are always passed by reference in MQL4.
Yes, thanks. But like I asked does that implies that on other language it isn't? If it were the only way to brought it about using MQ/MT4 or other language construct then I assume they wouldn't have to trouble themselves stating it.
I guess I'm asking the 'technical details' as you said on that post. Just out of curiosity not necessity.
As to the syntax, THE MQL5 language for programming trading strategies is very much similar to the C++ programming language, except for some features:
Like this, I can imply that on C++ the opposite will be true... Thanks anyway, Gordon.
I'm sorry, but it's not a "technical" response :) Could you say why it is better to pass variable by reference instead of global variable ?
Many reasons which I prefer not to repeat, instead I'll refer u to here -> https://en.wikipedia.org/wiki/Global_variable and here -> http://www.c2.com/cgi/wiki?GlobalVariablesAreBad (you can Google for more... It's a widely accepted concept and there's much info on the net).
[...] does that implies that on other language it isn't? [...]
Many reasons which I prefer not to repeat, instead I'll refer u to here -> https://en.wikipedia.org/wiki/Global_variable and here -> https://www.mql5.com/go?link=http://www.c2.com/cgi/wiki?GlobalVariablesAreBad (you can Google for more... It's a widely accepted concept and there's much info on the net).
Very interesting ! Unfortunately, EA need parameters, and sometime a lot, so we can't avoid them and have to take care for all reasons mentionned in https://www.mql5.com/go?link=http://www.c2.com/cgi/wiki?GlobalVariablesAreBad
I'm using naming rules for GlobalVariable : Much easier to manage and avoid some bugs.
Thanks Gordon.
Very interesting ! Unfortunately, EA need parameters, and sometime a lot, so we can't avoid them [...]
Externs are indeed unavoidable. Although they are global in scope, they are not the same as global variables (not to be confused with GV's); specifically - it is not recommended to change their value via code, hence they should not be used to pass info between functions anyway (see here -> https://www.mql5.com/en/forum/123535).
I'm using naming rules for GlobalVariable : Much easier to manage and avoid some bugs.
Just curous: are there ANY programming languages that have functions that return multiple results?
maybe you could kinda trick a function into returning two values by combining them in a way that you can uncombine them again in the calling function
something like this
a = 10;
b = 20;
a = a*1000
c = a+b // 10020
return(c);
then in the calling function
b = c%1000 // 20
a = c-b/1000 // 10
maybe you could kinda trick a function into returning two values by combining them in a way that you can uncombine them again in the calling function
something like this
[...]why not ?
why not ?