
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
Once again, for "candidates", "doctors", "professors" and "academics".
Any event coming to OnTradeTransaction() may be lost
That's why I think it is a mistake that after receiving meaningful eventTRADE_TRANSACTION_HISTORY_ADD
the data in the terminal will not be updated!
In Help(https://www.mql5.com/ru/docs/basis/function/events#ontradetransaction):
One trade request sent manually from the terminal or viaOrderSend()/OrderSendAsync()functions can generate several consecutive trade transactions on the trade server. The order of these transactions arrival into the terminal is not guaranteed, so we cannot build our trading algorithm on waiting for the arrival of some trade transactions after others. Besides, transactions may be lost when being delivered from the server to the terminal.
Therefore, it is not clear why this function is needed at all. You just should not use it, that's all. You have to analyse the history of orders and deals yourself.
In Help(https://www.mql5.com/ru/docs/basis/function/events#ontradetransaction):
It is therefore not clear why this function is needed at all. You just shouldn't use it, that's all. You have to analyse the history of orders and trades yourself.
As for orders, positions and transactions.
As written in the help - the sequence of transactions is not guaranteed - a transaction of order transfer to history can be received earlier than a transaction of a deal.
Changing a position in the terminal is strictly a result of receiving a trade transaction, so its receipt is a guarantee that the position has changed.
Obtaining a transaction to transfer an order to the history ensures only that the order has ceased to be active (open) and has been moved into the order history.
As for this phrase.
It seems to have remained in the documentation of one of the initial versions of the terminal with asynchronous trading. It will be removed in the near future. The culprits will be executed.
As for orders, positions and transactions.
As written in the help - the sequence of transactions is not guaranteed - a transaction of order transfer to history can be received earlier than a transaction of a deal.
Changing a position in the terminal is strictly a result of receiving a trade transaction, so its receipt is a guarantee that the position has changed.
Obtaining a transaction to transfer an order to the history ensures only that the order has ceased to be active (open) and has been moved into the order history.
As for this phrase.
It seems to have remained in the documentation of one of the initial versions of the terminal with asynchronous trading. It will be removed in the near future. The guilty ones will be executed.
Thank you very much!
And me a machine gun (or at least a rifle), to participate in the shooting? :)
MQ Alexander!
I would like a more extended explanation of the trades and positions.
Because YOU wrote:
And in fact it turns out the following:
Test Expert Advisor build 1375 demo opening (was run 2 times)
And here, the results:
Both times TRADE_TRANSACTION_HISTORY_ADD came first, but
in the first case there was no position but in the second case it was!
How should I understand it?
I forgot to attach the terminal log:
prostotrader, let me ask you an intimate question. Why are you so fond of historical orders and not fond of trades? :-))
MQ Alexander said:
Что касается ордеров, позиций и сделок.
As written in the Help - the sequence of incoming transactions is not guaranteed - the transaction of order transfer to history can be received before the transaction.Changing a position in the terminal is strictly a result of receiving a trade transaction, therefore its receipt is a guarantee that the position has changed.
Obtaining a transaction to transfer the order into the history only guarantees that the order has ceased to be active (open) and has been transferred into the order history.
And in your case
almost empty...
And another lyrical remark. In the concept of MT5 the presence of a history order reflects the fact that there was an attempt to make a trade. And it's not the fact that it was executed. And in order to find out we need to refer to the trade. It already reflects the result of the trade operation. Then it is more logical to deal with transactions in your code...
prostotrader, let me ask you an intimate question. Why are you so fond of historical orders and not fond of trades? :-))
MQ Alexander said:
And in your case
is almost empty...
I am answering to your intimate question.
You probably work on the FOREX market and deal with a single order,
So you persistently "lie" in an issue you do not even understand.
Imagine there are two steering wheels in a car and two drivers who both look only at the
the road. How would the 1st driver know that the other driver is steering (let's say to the right)?
Also look carefully:
All your primitive logic is based on the execution of a market order, so,
I'll bring it to your attention that there are limit and pending orders
which may not be fully executed but may be executed in portions.
Also, look carefully:
And what should I see there?!
Do you realise that you accidentally get position information in case TRADE_TRANSACTION_HISTORY_ADD?
And you have already been told that...prostotrader:
All your primitive logic is based on the execution of a market order, so,
I would like to bring to your attention that there are limit and pending orders
which may not be executed in full but in parts.
You're not the one to judge my primitive logic...
And who is to judge?
I judge your abilities by your statements!
The picture is clearly not pretty :(
Is that clearer, "Professor"?
And I don't recallMQ Alexander delegating you to answer for him.