
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
By the way, I know an example that would give me checkmate in my own challenge. But I won't write about it, for obvious reasons.
Sailed....))))
On the evil of global variables, and by the same token, public class fields.
Here's a look.
Now the right solution: change a global variable, if you can't get away from a crutch) only through a function.
On the evil of global variables, and by the same token, public class fields.
Here's a look.
Now the right solution: change a global variable, if you can't get away from a crutch) only through a function.
No, we're not. This example is from a veiled PLO. And what we are discussing here is a subset of it. I.e. the example shows that there are some things that can be normally solved only in OOP. The functions alone will not be enough. So it is not a contradiction in itself, but a two-star task.
Right. As long as we write programs up to ~3000 lines, we can safely use global variables. Then, if Vladimir wants to switch to OOP, he will abandon them). Right?
No, it's not. You have to learn right from the beginning) Every declaration of a global variable (not to be confused with input parameters, although they should be smaller too) should be clearly justified and made using the most unflattering statements (like underjunct vulgaris b...)
No, it's not. You have to learn right away) If you say evil, you mean evil) Every declaration of a global variable (not to be confused with input parameters, although they should be smaller too) should be clearly justified and made using the most unflattering statements (like underdog vulgaris b...)
I read all messages about global variables and understood, what all participants of this discussion wanted to say to me. I will learn how to write program code, while trying not to use global variables. Thank you all for this constructive advice!
Regards, Vladimir.
Got it. Global variables are evil. As the saying goes... "What's good for the Russian..." ))))
I continue studying the MQL5 programming language. I am pasting the revised code of the script again, taking into account the tips from the participants of this thread. I have tested the script in all modes. No problems detected. To begin with I have applied the minimum number of input parameters. The script code is written in English, comments to the code are in Russian, so that it is easier to digest. As I promised earlier, I tried to describe the script in a way understandable for a 1st class student of the programming school.
I hope I did exactly as I was told by the participants of this thread, but I could be wrong.
Regards, Vladimir.