![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Good point. It would be nice if the arguments were backed up by code rather than just blah, blah, blah.
Backing it up.
Here is my CMyObject class:
The CONVERT_OBJECT_WITH_CHECK macro is also defined at the end, which for the DEBUG version performs an additional pointer conversion check based on object type
Backing it up.
Here is my CMyObject class:
The CONVERT_OBJECT_WITH_CHECK macro is also defined at the end, which, for the DEBUG version, performs an additional pointer conversion check based on object type
It's beautiful. Of course, it's a matter of taste. But, based on MQL syntax, I would write it like this:
It's beautiful. Of course, it's a matter of taste. But, based on MQL syntax, I would write it this way:
Yes, that's right.
But, this is my senile "programming style" (hello, Volchansky with his recent thread).
I have all enumerations - begin with E, and then with "hump" notation - name. And the types themselves in enumeration begin with an abbreviation (up to four letters) of enumeration type.
Accordingly, since the enumeration is EMyObjectType, all values begin with MOT_
Are you an idiot? )) I haven't said one bad word about F#. Learn to read and understand what you're told before posting your stupid comments.
If you compare OOP with FP, it's more sensible to compare it with a pure FP language, i.e. Haskel. F# is already so-so, while python and R are not at all. That's what I mean. Otherwise we may come to a point where C++ is also an FP language.You are an illiterate troll. For the record, all the languages listed are functional in one way or another. Go and learn the subject area. The question was asked to understand what frame of referenceAndrei may be practicing one of the FP languages, so the listing was very general.
What's that supposed to mean?
What should be in the "base object" according to you?
Personally I have almost ALL objects in all my projects - inherited from CMyObject: public CObject, (in my object two more fields are added - class name and instance ID), and repeatedly found that I need CObject::Compare() functionality very much. A couple of times list pointers also came in handy.
CObject has one goal - to provide type control. And it manages it shakily. Methods like Next(), Prev(), etc. are for very specialized collections. They do not belong to CObject. The same relates to the Save and Load methods. It would be nice not to have Comparer in it either, but this is the only solution without interfaces.
As for the Type() method, it doesn't provide strict typing, because it returns the usual number. You may see on the example of your own code. You define a new GetType() method that returns the type as an enumeration. There really is no other way, I do it myself. That's why the standard CObject has to be appended to it, and it is incorrect.
Let's continue on CObject::Compare().
I have such object CFactoryBalanceResultSeries - it is a series with balance results with reference to the Expert Advisor's factory object. Actually it is a balance curve on history with reference to the Expert Advisor that has traded it.
So, I have a script where I compare these very balance series.
As long as there are only two series it's easy to compare them. But when there are dozens of them - you cannot compare by eye, you need a more formal comparison.
And just for automation of this process - I had to write a function that sorts these very series. And here it was useful, because CFactoryBalanceResultSeries class is an heir of CObject with its comparison function. If we override this function, we have a ready possibility of sorting series.
This is how this function looks like in my case:
That is, depending on type of sorting - we select required comparison function, which is used in common sorting function.
For example, if we want to sort the balance series by the part of the last drawdown from the maximum, the following functions will be used:
I'll continue with CObject::Compare().
From the recent
It's not very pretty, imho.
You could use a pointer to a function.
Yes, that's right.
But, that's my senile 'programming style' (hello, Wolchansky with his recent thread).
I have all enumerations - start with E, and then "hump" notation - the name. And the types themselves in enumeration begin with an abbreviation (up to four letters) of enumeration type.
Correspondingly, since EMyObjectType enumeration - all values begin with MOT_
Yes, I have the same enumeration.
ZS: Just got to the computer now. As expected, this thread quickly descended into rubbish.) I'll try to finish the story about virtual functions later. We should call this forum Blah Blah Blah Blah.)
I've read everyone's different interests...I'm in the process of redesigning a class to set up and manage a virtual grid, I need it.