Developed a library of API functions for MetaTrader 4 - page 4

 
According to the MT4 quote server settings - no operations more than once every 10 seconds can be performed. The server limits the frequency of different requests to prevent possible hacker DOS-attacks. This information was once raised on this forum.
It is not true.
The frequency of transactions is only limited by the reaction speed of the broker =)
There is no limit in MT.

The developers have said so on the forum, and more than once. But they always honestly warned us - you will have to deal with your broker by yourself ;)


Therefore it would be more fair to say, that pause is not obligatory (in technical sense), but at least desirable (in sense of danger of blocking of account).
 
I am interested in a simple example, I send three requests to place three orders, even if the interval is 20 seconds. At this time the market is slow and the interval between ticks is up to two minutes. Will the first two be lost or will all three be executed during the first tick?
 
I am interested in a simple example, I send three requests to place three orders, even if the interval is 20 seconds. At this time the market is slow and the interval between ticks is up to two minutes. Will the first two be lost or will all three be executed during the first tick?

Nothing will be lost. You don't need to implement any delay in the program. You start int NewPos(...) function for the first order. All the delays are already implemented in it. If the function returns 0, everything is okay - the request has been executed. We proceed to the second order, and so on.
If the execution is successful, the function will make a delay of 10 seconds by itself, so we won't have problems with frequent requests to the server. The critical waiting time of MT4 terminal's reply is also implemented in this function. If there is no reply from the terminal during this time, the function returns the code of an error situation. This has been done for diagnostics of situations related to missing quotes, account deactivation, Internet failures, etc.
This way when you return from the function the event has already happened. Good luck!
 
Orders processing commands will be executed only when the quotes for the pair, for which the Expert Advisor is installed, arrive. In other words, the button "BUY" in your program does not mean that the order is sent to the server, it is just "waiting on the disk" for the Quote of the pair where the Expert Advisor is installed. The EA will look for the file command and if it finds it, it will send an order to the server, and by the way, it will search for it on every tick. The result of placing an order or canceling the order may, respectively, only be received with the arrival of the next quote. This does not allow us to organize a clear logic for some TS. I hope that you understand it.


The logic of TS has nothing to do with it. The question is only about delays in order execution. But, as I wrote before, this problem is farfetched: the variability of quotes is determined by incoming ticks with new prices. During active trading up to 200 ticks per minute are received. Therefore, in this case there cannot be any lag. If you open a position in the period of sluggish trading, the price changes are almost non-existent, so the expectation does not have a big impact on the quote's level either.
Besides, we cannot talk about the "BUY" button here, because we are discussing mechanical trading systems, which make their own decisions without any buttons. Good luck!
 
According to the MT4 quote server settings - you cannot make transactions more than once every 10 seconds.

This was actually the case in MetaTrader 3, but MT4 no longer has this restriction.
But all the same, you have to be moderate and not to make a lot of operations in a row.
 
Actually it was like that in MetaTrader 3, but MT4 doesn't have this restriction anymore. <br/ translate="no"> But still, you have to be careful not to do too many operations in a row.

Yes, you are right of course. It would be better to foresee a delay right away which has been done in the developed library. Otherwise, if the requests are too frequent, the server can block the user's address with the corresponding consequences for trading. Good luck!
 
ATTENTION!
The new version of MFOREX library 2.05 for using of MetaTrader 4 API functions has been released.
Its benefits are:
1. During the work of library temporary files are not formed, data transport is made through shared memory areas. Such a solution significantly accelerates access to information and increases the reliability of the library;
2. In addition, special functions are implemented for terminal diagnostics, returning the time of the last tick and the unique computer code for the registration process;
3. The function of diagnostics of erroneous and emergency situations returns the code of the situation and saves the description in the special log in Russian.
4. The price of the library has been considerably reduced. Registered users of old version will receive updates free of charge.
Read all the details on our website http://www.min2006.ru
 


Unfortunately, the proposed EA:
- does not deliver quotes history;
- does not track errors and emergencies;
- does not give trading history and list of open positions;
- does not allow getting the latest quotes (in the form of ticks).

In the library that I propose all of the missing functions are implemented. Besides, the exchange of information is performed via shared memory areas without generating temporary files. Read all the details on http://www.min2006.ru
Good luck!
 
By the way, now what Min offers is more like what you can buy than before.
Pure imho :)
Reason: