[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 512

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
It's an obsession with wanting to pass parameters by reference. :-)
How else? Same thing to calculate 100 times?
Yes, I was wrong. In general. If it is clear here, the pending order is set only by price.
Here's the code:
The question is essentially uncomplicated. I passed formal parameters priceForBuy and priceForSell to the Trade(int signal, double& priceForBuy, double& priceForSell) function. The parameters are passed by the links. Isn't it done this way? The functions are local, not global.
An error has occurred during the compilation:
Where is the error coming from? I have already defined these parameters in theGetPriceToInput() function.
How else could it be? Do you have to calculate the same thing over and over again 100 times?
Make the signal part of the expert, as in the textbook, and you'll be happy!
I gave you all the links in the thread earlier...
How else could it be? Do you have to calculate the same thing 100 times over?
Well there are no concrete examples here:
https://docs.mql4.com/ru/basis/variables/formal
It is written at the top where the function parameters are like mine, i.e. & after the data type.
Well there are no concrete examples here:
https://docs.mql4.com/ru/basis/variables/formal
It's written at the top where the function parameters are like mine, i.e. & after the data type.
Maybe it will compile that way:
although the code structure is kind of "left-handed"...
Maybe it will compile that way:
although the code structure is kind of "left-handed"...
Well... I was the one who wrote it. Sing the first scoop. :)
I rewrote a little bit of the expert. This is what came out:
By the way, the error:
occurs exactly in thestart function these variables are not defined, not somewhere else. So something needs to be added to start?
By the way, the error:
occurs exactly in thestart function these variables are not defined, not somewhere else. So something needs to be added to start?
They must be defined in start() and passed by reference to the function we call.
This is the simplest way. But I am watching articles written by one programmer and there is nothing defined in the start() function at all.
Here's a link to his advisor:
http://www.forextrade.ru/media/Image/MQLabs/181_ag/ChannelByMACross_Expert.mq4
In particular, I'm very interested in how he writes code intelligently. Therefore, I want to learn how to write everything in separate functions, and add only the essentials tostart without declaring variables there.
If we pass a variable by reference into a function, we are working with a buffer of the original variable, not with its separate double. This means it doesn't matter which function we previously declared it in. Isn't it?