helpful
many thanks
hope to find the same for pointers and related issues
Thank you to the author for this article! I think it is very useful information for all beginners to learn MQL5 programming language. I added it to my favourites.
Regards, Vladimir.
Added: My only wish when publishing articles on a Russian-language forum is that all comments should be in Russian. So many times easier to digest the information. Here is an example. Instead of:
//addition function // returned data type is an integer - the name of the function is add - parameters or arguments are two int variables val1 and val2 int add(int val1, int val2) { //body of function that we need the function to perform when calling it //create a result new variable to be assigned by the result of val1 and val2 addition int result = val1+val2; //Print result in the experts tab Print(result); //returning value return 0; }
it would be great to see the translation at once:
//addition function //returned data type is an integer. The name of the function is add. The parameters or arguments are two variables of int type val1 and val2. int add(int val1, int val2) { //the body of the function that we want the function to execute when it is called //create a new result variable to which the result of adding val1 and val2 will be assigned int result = val1+val2; //Print the result on the Experts tab Print(result); //return value return 0; }
By the way, when I was translating the comments into Russian, I had one more addition in the form of a question: why does return in this function return zero instead of result?
Isn't it the author's mistake?
By the way, when I was translating the comments into Russian, I had one more addition in the form of a question: why does return in this function return zero and not result?
Isn't this the author's mistake?
Gentlemen programmers!!! Have my brains dried up to such an extent that I don't understand the purpose of the return operator or is it still the author's mistake?
Regards, Vladimir.
Gentlemen programmers!!! Have my brains dried up to such an extent that I don't understand the purpose of the return operator or is it the author's mistake?
Regards, Vladimir.
Hi Vladimir. I think that you have already become an experienced programmer enough to guess that it is just a mistake...
Hi Vladimir. I think that you have already become an experienced programmer enough to guess that this is just a mistake....
Good morning, Alexey! Thank you, of course, but I'm still as far from an experienced programmer as I am from Beijing. )) I'm just wondering how they let articles with such errors into the forum ?
Regards, Vladimir.
Good morning, Alexey! Thank you, of course, but I'm still as far from a sufficiently experienced programmer as I am from Beijing. )) I just wonder how they let articles with such errors into the forum ?
Regards, Vladimir.
Vladimir, "experienced enough" does not mean guru. This is not flattery.
The function is written and not debugged, so such errors are possible due to inattention. And what they miss......... How much staff do you need to carefully reread all the articles and correct such errors? It's not realistic... If you notice an error, you report it, it's corrected and everyone is happy.
Vladimir, "experienced enough" does not mean guru. It's not flattery.
The function is written and not debugged, so such errors are possible due to inattention. And what they miss......... How much staff do you need to carefully reread all the articles and correct such errors? It's not realistic... If you notice an error, you report it, it's corrected and everyone is happy.
The point is that beginners learn from these articles, including those with zero knowledge, and they have no opportunity to evaluate whether the code is correct or not, but only to take it on faith. ))
Regards, Vladimir.
Regards, Vladimir.
Added: my only wish when publishing articles on a Russian-language forum is that all comments should be in Russian. So many times easier to digest the information. Here is an example. Instead of:
it would be great to see a translation right away:
By the way, when I was translating the comments into Russian, I had one more addition in the form of a question: why does return in this function return zero and not result?
Isn't it the author's mistake?
Hello, Mr Brooklyn!
Thank you for your comment and your notification. This error has been edited and sent for publication correct.
Thank you very much
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Check out the new article: Understanding functions in MQL5 with applications.
Functions are critical things in any programming language, it helps developers apply the concept of (DRY) which means do not repeat yourself, and many other benefits. In this article, you will find much more information about functions and how we can create our own functions in MQL5 with simple applications that can be used or called in any system you have to enrich your trading system without complicating things.
Let's say that we need the software to perform the task of closing all open orders if the equity reached a maximum drawdown and we need to perform this task in many parts of the software, it will be better here to create a function and include all needed code or logic to perform this task then call this function in other parts but it will be not good or overwhelmed to write and repeat the same code in many parts to do the task.
If you are asking why we need to use this type of function, the answer to this question will lead us to learn the features of using user-defined functions and the following is for that:
According to what we mentioned about features of using functions, we can easily find how much will be beneficial when we use these user-defined functions in our software.
Author: Mohamed Abdelmaaboud