A function can take "reference parameters", which it can change values of. The declaration might look like the following:
void function(int &hi,double &ho) { hi = ....; ho = ...; }note the ampersand, &, which indicates that a parameter is a reference parameter.
The function would be invoked with variables to carry the return values:
int x; double y; ... function( x, y ) ...I remember there's something in the doc's about it somewhere...
H RichPlank,
Thanks, that seems to be something worth trying.
Just one clarification:
The function
void function(int &hi,double &ho) { hi = ....; ho = ...; }will it not need to have the
return();
in the end?
And after involking the function, we can use the x and y variables (with the changed values) in an expression, as any other variable?
MD
PS: congratulations on your system on the championship. Last time I checked it had no losing trades...impressive.
How can I contact you for a couple of questions about it?
H RichPlank,
Thanks, that seems to be something worth trying.
Just one clarification:
The function
void function(int &hi,double &ho) { hi = ....; ho = ...; }will it not need to have the
return();
in the end?
And after involking the function, we can use the x and y variables (with the changed values) in an expression, as any other variable?
MD
PS: congratulations on your system on the championship. Last time I checked it had no losing trades...impressive.
How can I contact you for a couple of questions about it?
The function is declared to be "void", which means that it does not return any value at all; it just returns control back to the calling place when it runs out of statements. You can also include an explicit "return;" statement, without any return value, but that's really only useful for "premature return".
The Surfer EA made a bad decision on Monday and opened a stupid trade, then stood there licking its stoploss for the best of the week, and is now sulking at a balance of $9,246 :-( Not really part of the plan, but there you have it. But the competition has been both fun and valuable for us; we have gained insight in the current state-of-the-art in EA making as well as particular's of our own system when tried under "real" circumstances. Anyhow, my email is ralph.ronnquist@richplank.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have some basic skills in mql coding, but right now I have a problem/question.
I have never seen, but is it possible to have the return function to return 2 values?
If the variables were x and y, it would look something like this:
return (x,y);
The idea is to have a function within an EA that would return 2 values, or the integration in an EA of a custom indicator that returns 2 values.
Help apprectiated.
MD