Discussion of article "Library for easy and quick development of MetaTrader programs (part XXVII): Working with trading requests - placing pending orders" - page 2

 
Реter Konow:

Almost 4 megabytes of code, and the library schema and custom methods are not provided... Are you writing for yourself?

Look through the eyes of your users. What it's like for them to understand all this without reference points.

Good, self-sufficient reference points are the articles themselves. Not only do they have guidelines, but they are also chewed up thoroughly - if you were too lazy to read them.

The scheme will be at the end of the library creation. As well as user-case-methods for quick access to all library features.

 
Реter Konow:

Specifically in this article there is no word why it is decided to send a pending order immediately after the internet connection, without re-questioning the user.

There is a warning that the pending requests presented in the article cannot be used in real trading. That is, it is all concept testing and nothing more.

There is no explanation for setting an order after reconnecting the Internet without polling the user.

And do you really need several articles to test an uncomplicated mechanism of a pending trade request? Moreover, it is easier and more correct to poll the user again and that's all.

I can see at once that you have not written trading functions and do not quite understand what we are talking about.

I will try to tell you again (it was in the last article): there are some errors of the trade server that require some delay before resending a trade request to the server.
Usually it is suggested to do this delay using Sleep(). But it stops the programme execution. So, the whole program will wait for the pause inside the trade method to complete before resending the trade request to the server.
Is this a good thing? In the general and simplest case, it is ok.
But an Expert Advisor can be multicurrency. And during the waiting time it will not do anything else but this waiting time.
Is it good? I think not - the Expert Advisor should continue to monitor the environment for all its working symbols. This is exactly what the pending requests provide it with: when it receives an error from the server that requires waiting, it creates a pending request with the required number of attempts and the required waiting time between them, and goes on doing its business. Then the trading class itself will send the necessary trade request to the server in time. At the same time it will first check "whether the time for execution of all the attempts allocated for the trade request is over". Therefore, the Expert Advisor will not send outdated orders to the server after a hundred and fifty hours.

And if you like to communicate with the programme so much, the "pending trade requests" I have proposed allow the user to set a condition when a trade order should be sent. You set the condition and go about your business - as soon as the condition occurs, the request will be triggered. This is one of the many methods of creating trading logic for Expert Advisors. And when the library will be available to build a graphical shell for your programmes, then it will be easy to create tools for creating trading logic - enter the necessary values, specify the type of request and when it needs to work, and that's it....

This is the first thing that comes to mind to explain and answer your question "why all this is necessary" - everything is done not "right here and now", but brick by brick, gradually.

 
Artyom Trishkin:

It's immediately obvious that you haven't written trading functions, and don't really know what you're talking about.

I'll try to tell you again (it was in the last article): there are some errors of the trade server that require some delay before resending a trade request to the server.
Usually it is suggested to do this delay with the help of Sleep(). But it stops the programme execution. So, the whole program will wait for the pause inside the trade method to complete before resending the trade request to the server.
Is this a good thing? In the general and simplest case, it is ok.
But an Expert Advisor can be multicurrency. And during the waiting time it will not do anything else but this waiting time.
Is it good? I think not - the Expert Advisor should continue to monitor the environment for all its working symbols. This is exactly what the pending requests provide it with: when it receives an error from the server that requires waiting, it creates a pending request with the required number of attempts and the required waiting time between them, and goes on doing its business. Then the trading class itself will send the necessary trade request to the server in time. At the same time it will first check "whether the time for execution of all the attempts allocated for the trade request is over". Therefore, the Expert Advisor will not send outdated orders to the server after a hundred and fifty hours.

And if you like to communicate with the programme so much, the "pending trade requests" I have proposed allow the user to set a condition when a trade order should be sent. You set the condition and go about your business - as soon as the condition occurs, the request will be triggered. This is one of the many methods of creating trading logic for Expert Advisors. And when the library will be available to build a graphical shell for your programmes, then it will be easy to create tools for creating trading logic - enter the necessary values, specify the type of request and when it needs to work, and that's it....

This is the first thing that comes to mind to explain and answer your question "why all this is necessary" - everything is done not "right here and now", but brick by brick, gradually.

If the connection with the server is interrupted, all calculations in the Expert Advisor stop, because the main engine of calculations is the price.
No Internet - no ticks - nothing to calculate in a multicurrency Expert Advisor. You need to wait for connection. After the connection is restored, you need to ask about sending the failed orders, and before that, you can sit in the cycle of waiting for connection - there is nothing to do anyway.
 
Реter Konow:
If the connection with the server is interrupted, all calculations in the Expert Advisor stop, because the main engine of calculations is the price.
No Internet - no ticks - nothing to calculate in a multicurrency Expert Advisor. You need to wait for connection. After the connection is restored, you need to ask about sending the failed orders, and before that, you can sit in the cycle of waiting for connection - there is nothing to do anyway.
Pyotr, connection failure is not the only error that requires waiting before repeating. You are just clinging to an artificially-emulated error for testing...
There will be no Sleep-waiting in the library.
 
Artyom Trishkin:
Peter, connection failure is not the only error that requires waiting before repeating. You are just clinging to an artificially-emulated error for testing.....
There will be no Sleep-waiting in the library.

It is impossible to track all the EA's calls to the server.


  • You can track trade orders sent to the server ONLY through the methods of your library. And if the orders are sent through your own functions?
  • How will you track and what can you do in case of a connection failure/connection if the EA uses its own methods to communicate with the server?
Hence the question:
  • What else can you suggest as a solution to server communication problems other than re-sending failed orders?


I ask because the solution to the problem of resending failed orders (obviously) does not require complication and is solved simply.

 
Artyom Trishkin:

...

Let me try to say it again (it was in the last article): there are some errors of the trade server that require some delay before resending the trade request to the server.
Usually it is suggested to do this delay using Sleep(). But it stops the programme execution. Thus, the whole program will wait for the pause inside the trade method to complete before sending a repeated request to the server.
...

Need a specific list of such errors, and an explanation - WHAT the library offers as a solution.

Need for users to get them to apply the library's functions rather than their own.

So what are these errors and what are your solutions in general terms?

 
Реter Konow:

...

I ask because the solution to the problem of resending failed orders (obviously) does not require complication and is solved simply.

I looked at the last article. There it is only about the failure of sending an order due to server unavailability. The form of the solution is much more complicated than I could imagine. But, the essence of the solution does not become more complicated.

There is no solution for other types of repeated requests.

 
Реter Konow:

I looked at the last article. It only talks about the failure of sending an order due to server unavailability. The form of the solution is much more complicated than I could have imagined. But the essence of the solution does not become more complicated.

There is no solution for other types of repeated requests.

Check it out :)
How can you not realise that to test the processing of pending queries I have emulated only one of the possible errors on purpose... In the next article I simplified this emulation - there is a reaction to the auto-trade button in the terminal.
And the list of errors is in the code. I don't want to explain it again for those who don't read it.
 
Artyom Trishkin:
And you test it :)
How can you not realise that to test the pending requests processing, I specially emulated only one of the possible errors.... In the next article I have simplified this emulation - there is a reaction to the auto-trade button in the terminal.
And the list of errors is in the code. I don't want to explain it again for those who don't read it.

This is not an answer.

You do not want to communicate on the topic, and show what pending requests the library can handle.

Each pending request (not order) needs its own solution, - its own magick, its own properties, its own methods and so on. And where is it?

 
Реter Konow:

That's not an answer.

You don't want to communicate on the topic, and show what pending requests the library can handle.

Each pending request (not order) needs its own solution - its own magik, its own properties, its own methods and so on. And where is it?

It's not me who doesn't want to communicate on the topic, but you don't understand the essence of this topic.
In three articles we are testing a new trading concept - trading with pending requests. Gradually new objects-queries are added in each article. Moreover, this is only a testing of the concept on a temporarily createdclass. In the fourth article of this topic, full-fledged classes of such objects will be created. And there are not many of them, but they are enough to cover all the needs of the concept.
Just, in order not to make me tell you all over again, please try to understand why you need it and what possibilities it can give you. I've only given a couple of examples - what immediately came to mind.