Invalid request - just started and can't figure it out... - page 6

 
-Alexey-:

Why, I have written one for myself, but for four.

So, have you personally written a universal library, detached from the EA's business logic and which can be used in any EA?

I don't believe in that either. Of course the server response handler code was there, but all within the business logic, not as a universal library.

 
Renat:

So you have personally written a universal library, detached from the EA's business logic and which can be used in any EA?

I don't believe in that either. Of course the server response handler code was there, but all within the business logic, not as a universal library.

Yes, I can prove it. For a certain amount of money, of course.
 
-Alexey-:
Yes, I can prove it. For a price, of course.

I mean, there is no library for MT4 either.

It wasn't that hard to prove.

 
Renat:

That is, there is no library for MT4 either.

It wasn't that hard to prove.

That is, it does exist. After the transfer of money it will be provided to you right now. But you do not have it for either 4 or 5.
 
Renat:

Renat, I have a feeling that the use of standard library falls under the chorus: "OOP or not OOP".

Otherwise I can't understand why people have strong beliefs that an OOP wrapper, which simplifies trading operations, shouldn't be used.

Some claim for a wrapper to do all the logic, handle errors, repeat queries, etc. And at the same time its use is supposedly dangerous and there is an error in every line...

 
-Alexey-:
I.e. it is there.

you don't have it. all errors are handled by business logic.
You use the synchronicity property in MT4, which simplifies processing to some extent, but your methods do not guarantee 100% of all cases. Probably 95% and that is purely your bible on which the whole trading process is based.
But MT5 is many times more complex in terms of handling return codes + asynchrony.

You're asking the impossible from a wrapper. The standard library is not business logic. It's a wrapper "over" the terminal functions. A wrapper over the stuffing of a candy bar.
It's a user-friendly interface that takes over some of the routine. Taking over the same kind of code. You don't eat a paper wrapper and complain why it's not edible. :)

But the wrapper can't guarantee anything, as you are the guarantor. Your business logic. :)
Just like the Print function can't guarantee free disk space. And logging errors. You have to use other functions for error handling and they are case specific.


-Alexey-, let's chat about specific flaws and you voice specific flaws that you would like to fix.

If you want, you can go through each return code and look at the main possible situations.

 
papaklass:


Answer the questions:
- why would I be dragging all these 61 methods behind me? Is it rational?

The question goes in the plane of whether or not you need OOP programming. I cannot answer it unambiguously.
In my practice I use OOP for high-level models.
Of course, I use a lot of it in my base just in the functions.

Correspondingly, when I use an OOP class it contains a lot of unnecessary things for some particular task. It is like the functionality of the kanvas drawing library. There are lines and squares and text. But there is nothing to argue about - whether this class should have a square or not. It is just there. For a particular task.


There are too many problems they are trying to solve within a single class.

you are mistaken. They are not solving any problems at all. they have wrapped themselves around RUTINA. is it hard to understand.


Consequently, error handling should be for all tasks to be solved.

It cannot be there. Since the bible does not solve any problem. It simplifies the RUTINE. That's all. It can't do more, and it doesn't need to be complicated.

The solution is simple enough: split one cumbersome class into several smaller ones, according to the problems to be solved:
In this case, I will involve only those classes that will fit my strategy and nothing superfluous. And it will be much easier to implement error handling than it is now.

Well, it's not a wrap-around routine. It's already a problem solver with YOUR expert's specific logic.
You cannot provide for error handling even in a single function - opening or closing. 1001 cases are always found, when intended errors don't fit and you have to do something else.

If you know a universal function for all situations, please show it. I cannot even imagine how it is possible to provide for all of the possible error handling in advance, without knowing the logic of a particular EA.
Even if I do make such a function - it contradicts all your uppermost words - "you have made too much noise again".

And if you apply your method of writing code through macros with direction (ORDER_TYPE_BUY / ORDER_TYPE_SELL), then the classes will be quite compact.
Where is it all?

But macros don't have error handling either. They are handled by business logic of a particular Expert Advisor in a particular error. It's not that hard to understand that there are no universal situations.

If Renat would learn to listen to the suggestions from the forum and try to grasp the meaning of these suggestions, MT5 would already be way ahead of where it is today at this stage of development.

Renat keeps repeating - we are on a technical forum. We cannot talk here about abstract things.

So please give us some specifics. Let's consider the terms of reference, the trading functions he needs and possible errors and how to handle them. ok?

 
papaklass:

Answer the questions:

- if I just need to place a market order, or a pending order, why would I drag all those 61 methods behind me? Is it rational?

- If I have an open position and just need to set stops, why would I drag all that functionality with 61 methods? Is it rational?

- If I have an open position with stops that will be triggered when the price reaches their level, why should I drag all these 61 methods? Is it rational?

No one is forbidding you:

  1. Don't use ready-made solutions in the form of libraries already written by someone else, but write your own code from scratch.
  2. Rewrite an already prepared library in the form of modified classes, removing from it the methods which in your opinion are "superfluous".
  3. Override methods from an out-of-the-box library, by inheriting
 
papaklass:

What's the point of "separating operations for trades into different classes".

It's the same as if you had different EAs for opening, closing and modifying. It seems to be possible, but no one does so (with rare exceptions, special tasks).

And I really like the phrase "if I just need to place a market order or a pending order, why should I drag all those 61 methods with me? Is that rational?"

Well there will be about 100kb of memory overhead per Expert Advisor. Geez...


By the way, here's a poll Do you use standard library for trading operations?

 
papaklass:

Frankly, I shouldn't have come out with my post.

Not for nothing, I realised I'm not the only one who is unconventional :) In the poll - I'll give it up