I have made a button on the screen and want to attach an Offline Chart opening to it. What function can I use to specify the path to the desired Offline Chart?
Left click on the picture to enlarge or right click and save
The MetaEditor has help for MQL-4 language. It makes sense to read it all, or at least look through it
Thanks for the reply. I don't understand it to the end. For example, I have the SendOrder(int &Ticket, int Type ,double LT ,double OP=-1 ,int ModeSL=0) function with parameters. Further, if I for example in code try to refer to it in any condition, I get error "parameter passed as reference, variable".
rabanik: if you go to .... error "parameter passed as reference, variable".
If the parameter is without & transfer by value, which is more reliable. The actual parameter is copied and a copy is passed to the function. The changes made to the parameter inside the function remain inside the function. The actual parameter at the place of the function call remains unchanged. And it doesn't matter for the function if a constant or a variable is passed to it, because in any case only a copy of the parameter reaches the function. This is done to increase reliability, to protect the variables from accidental change within a function.
When passing the parameter by reference, the & symbol is specified and it means that the reference, the address of the variable itself, is passed to the function. And the function can change this variable and these changes will affect the value of the variable inside the function which called this function. Well, for a function to change the value of a parameter, it must be a variable, the Translator most likely wrote: parameter passed as reference, variable expected = parameter by reference must be a variable
If in doubt again, I have the SendOrder(int &Ticket, int Type ,double LT ,double OP=-1 ,int ModeSL=0) function instead I'd better write how the function was called. It seems that you pass a number as the first parameter, which makes no sense. In this parameter, your function tries to return the number under which the order has been placed in the broker's database. Clearly this should be a variable. If in doubt, have a look at the function. And the function is TRUE to change the number being passed, it wants a variable in that place.
Wouldn't it be easier to understand from an example?
voidOnStart()
{
int a = 5;
int b = 7;
int c = f(a, b);
Print("a = ", a, ": b = ", b": c = ", c);
}
int f(int k, int n)
{
k += 2;
return(k+n);
}
//результат a = 5: b = 7: с = 14
The other option
voidOnStart()
{
int a = 5;
int b = 7;
int c = f(a, b);
Print("a = ", a, ": b = ", b": c = ", c);
}
int f(int &k, int n)
{
k += 2;
return(k+n);
}
//результат a = 7: b = 7: с = 14
Good day all!!! Let's assume there is a buffer in the indicator that I need to use in the calculation of other indicators. I want to use it in calculation of other indicators. How to make the indicator buffer be present but it doesn't show any icons on the chart? Thank you all!!!!
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
MetaEditor has help for MQL-4 language. It makes sense to read the whole help or at least to run through it
Good afternoon.
I have made a button on the screen and want to attach an Offline Chart opening to it. What function can I use to specify the path to the desired Offline Chart?
voidOnTimer() // On timer WindowRedraw(); // Redraw the window
Left click on the picture to enlarge or right click and save
The MetaEditor has help for MQL-4 language. It makes sense to read it all, or at least look through it
Thanks for the reply. I don't understand it to the end. For example, I have the SendOrder(int &Ticket, int Type ,double LT ,double OP=-1 ,int ModeSL=0) function with parameters. Further, if I for example in code try to refer to it in any condition, I get error "parameter passed as reference, variable".
Please, advise what to do? Thank you.
If the parameter is without & transfer by value, which is more reliable. The actual parameter is copied and a copy is passed to the function. The changes made to the parameter inside the function remain inside the function. The actual parameter at the place of the function call remains unchanged. And it doesn't matter for the function if a constant or a variable is passed to it, because in any case only a copy of the parameter reaches the function. This is done to increase reliability, to protect the variables from accidental change within a function.
When passing the parameter by reference, the & symbol is specified and it means that the reference, the address of the variable itself, is passed to the function. And the function can change this variable and these changes will affect the value of the variable inside the function which called this function. Well, for a function to change the value of a parameter, it must be a variable, the Translator most likely wrote: parameter passed as reference, variable expected = parameter by reference must be a variable
If in doubt again, I have the SendOrder(int &Ticket, int Type ,double LT ,double OP=-1 ,int ModeSL=0) function instead I'd better write how the function was called. It seems that you pass a number as the first parameter, which makes no sense. In this parameter, your function tries to return the number under which the order has been placed in the broker's database. Clearly this should be a variable. If in doubt, have a look at the function. And the function is TRUE to change the number being passed, it wants a variable in that place.
Wouldn't it be easier to understand from an example?
The other option
this is the difference.