MetaTrader 4 Client Terminal build 646: New Smart Search, Books in the Market and Updated Window of MQL4 Application Settings - page 9

 
ballenoz:

At the risk of sparking debate, why on Earth would you bother with OOP to write straight-forward trading EAs? The real advantage comes with reusabilty. If you are building classes that you and others might use many times over... definitely the way to go. If not, maybe OOP is of marginal benefit.


Yes, very true. In addition, sharing the true OOP code is nearly impossible in MQL4. There is no common code base that would implement basic OOP patterns. The standard library bundled with MT4 contains in fact only wrappers for built-n commands, and the published OOP code examples are mostly plain code streams with wrapper objects to substitute the build-in commands. No real OOP

If you liked to take full advantage from the OOP coding approach, you would need to create your own code base with basic OOP patterns first, i.e. libraries, or whatever you call it. And if every one has them unique, sharing application code written in true OOP approach is very impractical.

 

I agree, although the OOP approach is very interesting to learn about, its use in coding small projects like indicators and EA's is definately questionable. I also think OOP tends to create bloated code containing all kinds of unused functionality, you can see this by looking at the included files in the metaeditor, if you need arrows you can use CChartObjectArrow which is derived from CChartObject, do we really want to call all that code just to put arrows on a chart when we could accomplish that in a simple ten line, requirement specific function ? Or more to the point, do we really want to invest so much time to write such classes so we might use them again in another EA, when each EA would be more efficient if most of the code is written specifically for it ?

There are lots of articles about that point of view to read, I just found one here https://www.mql5.com/go?link=https://blog.codinghorror.com/your-code-oop-or-poo//

 

Ok thanks for all the comments about OOP ... I am new to it and after studying it for that last couple of months
I thought I must have missed something about why it is better to use OOP than procedural coding for my stuff.
Now I realize that I missed nothing.... it really is something totally unnecessary for what most of us are doing with Mql4.
The name of the program is MetaTRADER ... not MetaCODER....
thanks again everybody..

PipPip...Jimdandy

 
I am new to it too, my comments are based on what I have learned so far, I have asked several times on different forums why do we need to write classes vs separate functions, I cant get a straight answer they just ramble on about polyporphism and large databases. Maybe i'm just totaly missing the point ...
 
SDC:
I am new to it too, my comments are based on what I have learned so far, I have asked several times on different forums why do we need to write classes vs separate functions, I cant get a straight answer they just ramble on about polyporphism and large databases. Maybe i'm just totaly missing the point ...


I think the question has already been answered in a way that summarizes it all:

ballenoz: The real advantage comes with reusabilty.
 
Yes I understand that, but isnt that what fucntions() are for already ?
 

Just few months ago I wrote about order's comment, but the matter was fast solved with a laconic phrase : "Orders'comments are not reliable."

But a such response is not enough for solve a lot of interest linked to comments.

I don't wanna talk about comment after a partial closing but the comment after the opening! I have seen that if the waited comment is longer than 32 character what appears is a couple of brackets with magic number inside.

Nowadays we work with 64 bits OS, the millenium bug is so far from us but a comment still preserves a lenght limit! No truncate solution (at least) but a substitution!! Let's think an EA that generates hedge orders linked to a specific base order (i.e. #567) and every hedge order have to report in comment their pedigree with a special string into the comment (i.e. "Hedge of #567# "). We can have some base orders and for every ones we can have one or more hedge orders. To keep EA secure, transportable and get full fail over compliance, we need to incorporate infos in the comment (best solution will be to add a field "TAG" in the order properties...). We can't think to work with Platform variables or file I/O (if I have to change PC these information will be lost).

I think that the solution is simple: in the struct/class of the order, enlarge the variable size from nchar to varchar and change the feature of comment rendering from substitution solution to truncate (in case of nchar).

 

I was just playing around with some global variables at the top of the file. I then moved the variable down the page somewhat and then called it from the OnDeInit() above it.. To my surprise you can declare a global variable at the very bottom of a file and yet all of the code above it will work.
In the past I had thought that the compiler would throw a warning or error as it compiled the file because of not declaring the variable above the code where it is used. Am I just imagining that? I'm still putting my globals at the top but was just wondering if I had dreamed this or if it really has changed. PipPip....Jimdandy..

 

Why after build 646 I can't run Custom indicator see the picture

 

Same problem of fabio7774, after update to build 646, emails stopped working. The email configuration did not change (five MT4 installed all with the same problem).

I had to change the SMTP service provider to GMail to have e-mail working again.....

Reason: