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
Yes, I too have a similar situation. It's not hard to learn, it's harder to retrain, to break old habits. I still can't kick many bad habits of procedural programming.
relearn from procedural style? hmm, well written procedural style code is usually easy to wrap into a class, if you need to scale up the project
You can just forget about constants and statics for now. And don't even think about interfaces.
And when everything is ready, then look and mark something as a statics and something as a constant. And you can forget about interfaces altogether.
I know how to do a lot of things fast,
I decided to devote my time to studying theory, or rather to bring MQL up to the level of what has been out there in the past few years, even many people here don't know about the capabilities of terminals
If I'm going to study the material, I need to study it properly, imho, and to understand whether MQL is closer to C++ or C# - for now it seems to be C++. In C# people don't even bother with modifiers, or rather they just fix whatever the studio marks as suspicious )))
Constants and statics can simply be ignored for the time being. Interfaces, too.
And when everything is ready, then look and mark something as a static and something as a constant. And you can forget about interfaces altogether.
The main thing is to hold constants and statics. I agree about the interfaces.
retrain from procedural style? hmm, well written procedural style code wrapped in a class, if you need to scale up the project, usually no problem
I know how to do a lot and fast,
I've decided to devote my time to studying theory, or rather to bring MQL up to the level of what's been developed over the last few years, even many people here are not up to date on the capabilities of terminals
And if you study the material you have to study it properly, imho, and to understand what is closer to MQL to C++ or to C# all the same - for now it seems to be C++.
const - if it is necessary to forbid assignment of a variable (except for one-time initialization). If a variable is declared as conts, then when you pass it into a function by reference, function argument should also be const, but the compiler will make this happen, you don't have to think about it. If a variable is not being assigned, it can also be marked as const - it will work faster, this applies to function arguments. However, at any moment, you may need to modify it...
static - if it's a variable in a class, it's a rare case, even the rarest. If it is a class method, then if the method handles only arguments of this method andstatic variables of the class, it is also a rare case (however, not so rare, if you just collect functions into a class for convenience).
I'd like an example, I'm telling you, I'm not good with modifiers at all.
SZS: in the meantime what goes on in general horror in programming discussion in Inet - here was an article about const on hubra last month, the meaning - yes, this const is not necessary, look assembler code does not differ that without const - the compiler will remove everything ((
Here is an example:
It's not clear from your code why an interface is needed, so I threw it out.
Of course, I don't know your task completely, but there's a 99.99% probability that it's not needed.
relearning procedural style? hmm, well written procedural style code wrapped in a class, if you need to scale up the project, usually not a problem
I know how to do a lot and fast,
I've decided to devote my time to studying theory, or rather to bring MQL up to the level of what's been developed over the last few years, even many people here are not up to date on the capabilities of terminals
If I'm going to study the material, I need to study it properly, imho, and to understand what is closer to MQL to C++ or to C# all the same - for now it seems to be C++.
Here's an example:
From your code, it is not clear what the interface is for, so I have thrown it out.
I don't know your task completely, but it's 99.99% sure you don't need it.
this is the 5th time I've heard that you should throw out the interfaces and don't bother)))
I took the "Strategy" OOP design template as a basis.
applied, as specified, interfaces as an abstraction from which I inherit the base class CStrategy - it turned out that my CStrategy will be absent public methods, all public are described by interfaces (3 pieces = strategy itself, strategy completion and now added a record of the strategy state ) The role of the interfaces is... well, about the same as with const modifiers - you get warnings at the beginning if you don't describe a method or try to close them with inheritance - so far I have more convenience than problems.
In general I confirm that with 100% probability it's unnecessary... but it's just convenient that the CStrategy class doesn't have a public section
Your code looks good, I'll reproduce it in my place after lunch, try to compare it with mine
Thanks!
The mql itself is based on c++, but through the efforts of its creators they've put much of the bad of sharp into it, without adding anything good of it. Sharpe-like standard library is telling. It would look more logical if it was similar to std. IMHO.
maybe it was me who started the phrase on the MQL forum "it's not C++, it's MQL..." now a lot of answers to questions like yours in this context ))))
in general the language is quite democratic, not convenient to write in MQL - "in 2 clicks" you can go to .dll C++ and here since the beginning of the year in .dll C#, if memory serves, one of the first articles on dll from Developer Renat - i.e. this possibility initially, as a product concept is offered, imho
SZS: to write above, for some reason came to mind the phrase - I am an artist - I see so!)))
ZS: to the above, for some reason came to mind the phrase - I'm an artist - I see so! )))
this comes to mind very often in responses from developers, good or bad, I do not know
If the developers would give information and close questions once and for all - why you can't add or change a function
this comes up very often in the developers' responses, good or bad, I don't know
if developers would give information and close the questions once and for all - why it is impossible to add or change a function
Well this is the existing corporate style of communication between users and support of IT monopolists, the Internet is full of cases where users find the obvious bugs Microsoft and after appealing to Microsoft get in response ... usually silence ))))
ZS: from a recent read, Hubr " Why does Windows read one file a hundred thousand times to open a menu? "