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().
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).
Mikhail Tkachev: NB_M1 is an object of this class. How to put it inside ?
I think that's the way it should be
bool NB_M1;
intOnInit()
{
}
voidOnTick()
{
NB_M1=new CIsNewBar(_Symbol,PERIOD_M1); // Эта строка потом будет в цикле для разных символовif (NB_M1) // (1) Если появился новый бар M1
{....}
......
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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