
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
I have now redesigned my class
And added inheritance ... ( I suspect I may be wrong ) from the vr_MarketInfo classThe vr_MarketInfo class returns information about Point, Digits for the symbol and checks the lot for errors, and many other things I need for work including keeping a log in Excel and on a chart
When using a method like above a list is given when working in Primer.Primer.Primer()
I would like to do something more abbreviated...
Where is the inheritance? What's the point of the pointer?
Where is the inheritance? What is the point of the pointer?
Write a textbook on MQL4+. Cooperate, connoisseurs, and write it. 50 bucks :)
Write a textbook on MQL4+. Cooperate, connoisseurs, and write it. 50 bucks :)
Everything was written a long time ago.
MQL4 == C++ with slight limitations.
As a matter of fact, neither the manual, nor the documentation offers any specifics on how to use pointers, or the new operator. We can either guess or wait for the weather to pass. Or when somebody accidentally says something somewhere. I am shocked how it happens. It's also interesting that except for me and the topicstarter VLadimir nobody seems to need anything. Although I still believe that many people do not understand this topic. And that is why they don't pry into such questions...
What kind of specifics do you need? One principle applies everywhere: keep things as simple as possible. Don't go into the thick of things just to be in the thick of things. If a problem can be solved simply, it must be solved simply.
Dynamic pointers are needed if your program needs to dynamically work with objects: create, delete during the running of the program. If you know beforehand which and how many objects are needed in the program, you don't need dynamic pointers. But unless you have a lot of objects, you can simply create them in a loop with new.
I for example find it hard to learn the theory, show me an example and describe how functions define circle, square, trapezoid or triangle.
One of the articles linked in the first post has this example.
A base class with a virtual method. The descendant has a method with the same name, in which the calculations are made.
I for one find it hard to learn the theory, show me an example, and describe how functions define a circle, a square, a trapezoid, or a triangle ???
I leave trapezoid and triangle to my own work:
Dynamic pointers are needed if the program needs to work with objects dynamically: creating, deleting them during the program operation. If you know in advance which and how many objects will be needed in the program, you don't need dynamic pointers. But unless you have a lot of objects, it's easier to create them in a loop with new.
Your class is 90% redundant. Only two functions perform the main work, these are openorders and tip Why do you use Sel, Buy SelStop, etc., when in fact they all just call Openorders? Furthermore, the order type is passed as int, so it's not protected. Instead of int you'd better use either your own enumeration or the standard ENUM_ORDER_TYPE. And in general, you'd better never use magic numbers "1", "2" etc., only enumerations. This will prevent you from sending the left order value to the function. The Openorders function itself is too big. Obviously, it consists of two blocks, the block of making a deal and the block of checking conditions. Each of them should be as a separate private function.
It's a good start, but there's still a lot to learn. The tip function would be better rewritten as follows:
What specifics are needed? The same principle applies everywhere: everything must be done as simply as possible. You don't have to go into the wilderness just to be in the wilderness. If a problem can be solved simply, it should be solved simply.
Dynamic pointers are needed if the program needs to dynamically work with objects: creating, deleting during the program operation. If you know in advance which and how many objects will be needed in the program, you don't need dynamic pointers. But except when there are so many objects, it's easier to create them in a loop via new.