Questions from Beginners MQL5 MT5 MetaTrader 5 - page 179
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
This is not a pointer to itself, but a pointer associated with the field identifier in the object implementation.
I.e. there may be a local variable with the same identifier as the field in some object method, in which case you can use this to distinguish a pointer to the object field from a pointer to a local variable.
What purpose could this be used for? Can you give me an example?
but for what purposes this may be needed? can you give an example?
In this case, when creating a LineNode, you need to specify the parent node to which the current LineNode instance belongs. The parent node will then be able to refer to this instance by reference. In this example, the word this is used twice. In the first case, the word this specifies that the childNode variable refers specifically to the current class, while the childNode without this is a LinkWithNode method variable of the same name. In the second case, this returns the current instance of the class and GetPointer receives a pointer to it. This allows you to bind a LineNode at the moment of creation.
In this case, when creating a LineNode, you need to specify the parent node to which the current LineNode instance belongs. The parent node will then be able to refer to this instance by reference. In this example, the word this is used twice. In the first case, the word this specifies that the childNode variable refers specifically to the current class, while the childNode without this is a LinkWithNode method variable of the same name. In the second case, this returns the current instance of the class and GetPointer receives a pointer to it. Thus it is possible to bind LineNode at the moment of creation.
i.e. in the second case, it will lead to code reduction?
i.e. in the second case, it will lead to code reduction?
No, that's not it. This allows us to control an instance of a class already in its definition. Knowing this, we can impose our own unique behaviour on a particular instance. This achieves a high degree of flexibility and abstraction.
A word of advice. I'm moving from mql4 to 5, I'm going to write an indicator for 1000 or 10k buffers. Is it possible to name the buffers with variables?
Like
while( a<1000)
{
a++ B++
buffer name = buff+a
buff(a)=iMA(null, B,) }
And subsequent buffer processing with the same looping
Or any other way to reduce time and code with new mql5 features.
First of all, the limit is 256 buffers (I could be wrong).
And buffers are ok, you can put them in classes, give aliases and search by aliases.
Somewhere in articles tol64 saw, I can not remember at a glance, look for it.
First of all, the limit is 256 buffers (I could be wrong).
And everything is OK with buffers, you can put them into classes, give them aliases and search by aliases.