Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1566

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
If you have an EA of three lines, then of course you don't need OOP).
But if I had to create Goblin with one arm and three legs, and then with one leg and three arms - then, yes, that's where OOP would really help me out. Although... I don't know either.
What's the point of having it here?
And it doesn't matter at all how many "lines" you have. ;)Only int or double?
What if the variable is an object of a class?
And if number of such objects is unknown beforehand [before execution of OnInit()]?
And if the parameters of constructors in advance [before OnInit()] are unknown?
You gave a good link and example about declaration of classes.
In any case, the global ones are declared before OnInit(); the others are declared each time they are needed
In any case, the Global ones are declared before OnInit(), the others are declared each time they are needed
This is clear in theory.
In practice, after :
declaration of 'NB_M1' hides global variable -> per line in OnInit()
see previous declaration of 'NB_M1'
the expert works as if NB_M1 was global (and correctly initialized), even though it is hidden by a local declaration and initialized as local in OnInit().
By idea, it shouldn't work at all.
In theory, this makes sense.
In practice, after :
declaration of 'NB_M1' hides global variable -> per line in OnInit()
see previous declaration of 'NB_M1'
the expert works as if NB_M1 was global (and correctly initialized), although it is hidden by the local declaration in OnInit().
By idea, it shouldn't work at all.
And it doesn't matter how many "strings" you have. ;)When you have a hundred or two lines of code, because you want to start with this, then forget what this is for, then add this, then naturally (?) the thought will arise: "How to organize it?" Or not).
What is NB_M1? Perhaps it is already declared in the library? And without code at all, it's like deaf and blind)
NB_M1 is an object of class CIsNewBar to define the start of a new bar for each character. No, it is not declared in the library.
Code in first post :https://www.mql5.com/ru/forum/160683/page1547#comment_23712294
NB_M1 is an object of class CIsNewBar to define the start of a new bar for each character. No, it is not declared in the library.
The code in the first post :https://www.mql5.com/ru/forum/160683/page1547#comment_23712294
So, NB_M1 is declared inside the class and can be accessed there
Can we have a look at the code of this class?
NB_M1 is an object of this class. How to put it inside ?
NB_M1 is an object of this class. How to put it inside ?
I think that's the way it should be