Errors, bugs, questions - page 1889
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
Is this a bug or am I missing something? A normal parabolic EA places a stop order at the previous point, in the case of buy with the spread taken into account.
And so the price (Ask) has reached the order price 57781, but the order is not opened.
What is the runtime error
if you do this:
i.e. conversion to parent, then everything goes correctly, apparently very significant changes in language structure took place and now derived type is unambiguously not an ancestor type.
Checked on C++:
Pre-conversion of a parent class object to a derived one is handled correctly, i.e. there is an error in the MQL5 mechanism with type conversion, unless it was not designed that way.
What is the execution error
If you don't check what dynamic_cast returns, there is no point in using it.
if you do this:
i.e. conversion to parent, then everything goes correctly, apparently a very significant change in the language structure has taken place and now the derived type is unambiguously not an ancestor type.
If you don't check what dynamic_cast returns, there's no point in using it.
Thanks, in my example it returns NULL. Why does this happen?
Could you give a practical example of how to use this trick?
Developers use it only in Graphic.mqh as follows
At the same time they have definitions of classes/objects like this
That is, they pass a parent pointer to a child. Well, that's exactly what I do in my example! Where is the snag?
A pointer to a parent class can actually contain a pointer to a descendant.
A pointer to a parent class can actually contain a pointer to a descendant.
Thank you, I got it!
I still don't understand why in MQL you can't cast a pointer to a descendant class pointer type, but in C++ it's possible, can you explain if it's a bug in MQL or it should be like that?
is it possible in C++, can you explain if it's a bug in MQL or should it be?