Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1072
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
Left click on the picture to enlarge or right click and save
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.