Help with the meaning of an input variable
It passes the variable (probably an array) by reference. You can't return an array from a function so if you have a function that modifies an array how do you use it for different arrays ? you pass the array name to the function by reference . . .
OK, in this case the variable being passed is not an array . .
It passes the variable (probably an array) by reference. You can't return an array from a function so if you have a function that modifies an array how do you use it for different arrays ? you pass the array name to the function by reference . . .
OK, in this case the variable being passed is not an array . .
first of all, thank you for help!
then,since it's just a variable,not arrays.....so let's just talk about this case:
now i know this thing is called "reference", the same in C++.
My understanding is that:
the variable "margin" is what we need, but the OrderCalcMargin() is defined as "bool", so it can not return a double type variable.
then we use the reference thing to let the function judge T or F, meanwhile, we can "reference" the value of "margin".
is that right?
the variable "margin" is what we need, but the OrderCalcMargin() is defined as "bool", so it can not return a double type variable.
then we use the reference thing to let the function judge T or F, meanwhile, we can "reference" the value of "margin".
is that right?
Yes I think it is just about right . . . just to add that it also allows the modification of the value of margin without returning that value or having it as a globally defined variable.

- Free trading apps
- Free Forex VPS for 24 hours
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'm studying the 2010 ATC Avoitenko's EA,
There's a function called OrderCalcMargin() used in EA,which is defined as below:
bool OrderCalcMargin(string symbol, // Symbol namedouble volume, // Lots
double price, // Open price
double& margin) // output value
{
string first = StringSubstr(symbol,0,3);
string second = StringSubstr(symbol,3,3);
string currency = AccountCurrency();
double leverage = AccountLeverage();
double contract = MarketInfo(symbol, MODE_LOTSIZE);
margin = 0.0;
...........
}
I know that is a bool function which return true or false, and the function actually calculate the margin that is needed for trading.
My qusetion is that:
what does the double& mean? can anyone explain for me?