[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 610

 
ruslanchik:
what is the calculation ahead of a=5 or a=10 ?
Well the program is run from top to bottom) First 5, then 10.
 
Solree:
Well the programme is run from top to bottom) First 5, then 10.
I see... it will update the "obvious" parameters to the set ones.
 
ruslanchik:
OK thanks... in short it will update "explicit" parameters to the given ones

When parameters are passed to a function by reference, it is the variables that are passed to the function that are changed.

Suppose you need to return more than one parameter from a function. Pass them to the function by reference. The variables that are set outside the function - the variables you passed into it by reference - will be changed in the function.

If you have three variables e, f and g, if the appersand in the function description before the variable name in its parameters, the variables will be changed that you put in the parameters when calling the function.


int func (int a , int &b , int &c ) {

a=10;
b=20;
c=30;
return(a);

}


When calling a function:

int e=40 , f=50, g=60;

int d=func (e, f, g);

d will be equal to 10 (the function will return modified e)

f will be equal to 20

g will be equal to 30

f and g are passed here by reference

 
artmedia70:

When parameters are passed to a function by reference, it is the variables that are passed to the function that are changed.

Suppose you need to return more than one parameter from a function. Pass them to the function by reference. The variables that are set outside the function - the variables you passed into it by reference - will be changed in the function.

If you have three variables e, f and g, if the appersand in the function description before the variable name in its parameters, the variables will be changed that you put in the parameters when calling the function.


int func (int a , int &b , int &c ) {

a=10;
b=20;
c=30;
return(a);

}


When calling a function:

int e=40 , f=50, g=60;

int d=func (e, f, g);

d will be equal to 10 (the function will return the modified e)

f will be equal to 20

g will be equal to 30

f and g have been passed by reference here

Where can I get a Help on a similar topic ... with examples .... I sat down to do something, but realized that I cannot build a system without references .... By the way, the Help also from S.K. (Sergei Kovalev) is also not much on the topic
 
ruslanchik:
Where can I get a Helpup on a similar topic ... with examples .... I sat down to do something, but realized that I cannot build a system without references .... By the way, the self-help book by S.K. also contains not much information

Look carefully in the DOCU - there is EVERYTHING, you just need to be able to readhttps://docs.mql4.com/ru/basis/variables/formal
 
FAQ:

Look carefully at the DOCU - There is EVERYTHING there, you just need to be able to readhttps://docs.mql4.com/ru/basis/variables/formal
and what exactly to stick my eye on if you haven't noticed it yourself..... " please explain how to "pass parameters by reference" the inline help gave just hints on how to use it but it's not very easy to figure out... from page 609 "
 

It is possible to pass parameters by reference. In this case, modification of such parameters will affect the corresponding variables in the called function passed by reference. You cannot pass elements of arrays by reference. Parameters can be passed by reference only within the limits of a single module, such an opportunity is not provided for library functions. In order to specify that a parameter is passed by reference, the & modifier must be placed after the data type.

Example:

void func(int& x, double& y, double& z[]) { double calculated_tp; ... for(int i=0; i<OrdersTotal(); i++) { if(i==ArraySize(z)) break; if(OrderSelect(i)==false) break; z[i]=OrderOpenPrice(); } x=i; y=calculated_tp; }

Arrays can also be passed by reference, all changes will be reflected in the original array. Unlike simple parameters, arrays can be passed by reference in library functions as well.

Parameters passed by reference cannot be initialised with default values.

 
Good evening. I am trying to understand the bars. I want to write a script to analyse the daily bars. I am trying to analyze the history and the percentages of them. I want to collect statistics not only for the entire history but for a selected timeframe as well. I tried to search for a script but there are too many of them. I would like to ask for a link to such a script or give advice on how to deal with bars, as I have no experience.
 
ChAnton:
Good evening. I am trying to understand the bars. I want to write a script to analyse the daily bars. I am trying to analyze the history of the bars and the percentage of their occurrence. I want to collect statistics not only for the entire history but for a selected timeframe as well. I tried to search for a script but there are too many of them. I would like to ask for a link to such a script or give advice on how to deal with bars, as I have no experience.
Do you have any programming experience? If you don't, you should read textbook and documentation (links are on the top of the page) and learn the basics... More about bars here https://docs.mql4.com/ru/predefined/variables
 
Hello, I understand that OrderOpenTime() returns the number of seconds elapsed since 00:00 1 January 1970. How do you convert to normal time?
Reason: