Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1098
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
Please tell me why the compiler generates a warning in the following MQL4 test script code:
A warning on line 27 about data type mismatch. Both variables have the same int type. Below is a screenshot of the script compilation.
If I replace line 27 with
the warning doesn't show up.
What is the trick?
There is no trick. The variable t is declared as double
In fact, this t takes no meaning anywhere.
And there is no trick. The variable t is declared as double
Thank you very much, I'm working hard - it's time to rest.
In fact, this t doesn't take any value anywhere.
It's a buffer variable used to temporarily store the result during sorting.
How are these initialisation methods different?
class Klas{}; Klas *Klas_ Klas Klas_
1. class Klas{}; 2. Klas *Klas_ 3. Klas Klas_
1. type (class) description
2. declaration of type (class) pointer
3. declaration of class instance - this is initialisation, because Klas() constructor will be called if it's not described, then default constructor will be called - help
How are these initialisation methods different?
i.e. initialisation only step 3.
1. type (class) description
2. declaration of type (class) pointer
3. declaration of class instance - this is initialization, because Klas() constructor will be called if it is not described, then the default constructor will be called - help
i.e. only clause 3 is initialized.
I haven't seen how to initialize them in the help, maybe I just watched it and didn't understand, since classes are poorly described in the help - I read it 30 times.
Yes, indeed after the class as I have no entries but they have put this code in OnStart
Understand it however you want. I don't know why I should explain it that way.
I don't understand why I need this pointer.
And what is this for? Whatever you want and what you think it means.
I also don't understand what this means.
CFoo foo40(foo1); // явный вызов конструктора копирования
What this is for is also not clear. They would not have uploaded it, but would have written down the idea normally and simply.Greetings.
Could you please tell me how the horizontal levels for the grid are calculated in mt4 and in mt5?
And why initialize via pointer, I haven't seen it at all in help how to initialize them maybe I looked and didn't understand, because classes are poorly described in help read 30 times.
a pointer is a pointer, initialization is initialization
understand this code first:
What is initialization in this code and what is a variable declaration?
When is memory being allocated?
and then treat the subject of OOP and pointers to a class and pointers to an object with this knowledge.
go away, for some reason I can't answer elementary questions
a pointer is a pointer, an initialisation is an initialisation
understand this code first:
what in this code is initialization and what is variable declaration?
When is memory being allocated?
and then use this knowledge to discuss OOP and pointers to a class and pointers to an object.
gone, for some reason I can't answer elementary questions.
Here is a simple and clear example. 1st variant is declaration of variable and memory allocation(variable stores default rubbish arbitrary value or sector number or address in C++ here I don't know), 2nd variant is initialization.
And what these pointers to Type are for and what to eat them with should also have been explained normally.
Pointers to a class and pointers to an object
I should also have understood what they are. I will look it up on the net and see if there is something.
Greetings.
How do you calculate horizontal levels for a grid in mt4 and in mt5?
If you want to detect a horizontal level, just open/close a new level and place a new order, or place a grid of pending orders taking into account the maximum number of orders and then display that grid.
there, in general, any compact code is easier to view and modify for your own tasks
I don't know if you have tried it and I've never tried a lot of programs and I think it's more difficult to use in simple TS, but maybe you have never tried it.
Here is a simple and clear example. 1st option is declaration of variable and memory allocation (variable stores default rubbish arbitrary value or sector number or address in C++ here do not know), 2nd option is initialization.
And why these pointers to Type and what to eat them with should also have been explained properly.memory allocation will be in Example 1 and in Example 2
example 2 is a declaration and initialization, example 1 is only a declaration
the class is the same, the class is a user-defined type that contains fields (properties) and methods of working with these fields
a pointer to a class is a declaration, but without initialization and without memory allocation for the type (class)
pointer = new MyClass(); - this is a declaration and initialization, which creates a new instance of the class and this instance will be returned as a link to an object (not exactly a link, in MQL it's ... not important and so you get confused)
....
if you don't want to read it, at least use this post of mine to modify your example:
CFoo *pfoo6=new CFoo();
to
CFoo *pfoo6; pfoo6 = new CFoo(); CFoo *pfoo_7 = pfoo6;
and try to understand what happens - when you assign the last line to..... but still read, just asking on forums is not an option