Features of the mql5 language, subtleties and tricks - page 23

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
No, you don't. You just need to know how the last position was closed (and there is no need to go much deeper into the history for that - it is enough to filter "your" deals) - the knowledge of the last position deep into the history is more statistical than operative.
Well, all this is done in OnTradeTransaction. Only in trigger published by fxsaber : I would add a check on symbol, magician and trade on DEAL_ENTRY_OUT
How will you check in the tester?
I didn't look at this trigger carefully, but I didn't see any check for DEAL_ENTRY_OUT. After all, this is the deal that indicates the closing of the position on the accounts.
Verification is not needed. The trigger will not work in the tester, because the tester does not generate some Trade events.
Which ones, for example from this list?
TRADE_TRANSACTION_ORDER_ADD
Adds a new open order.
TRADE_TRANSACTION_ORDER_UPDATE
Modification of an open order. These changes include not only explicit changes from the client terminal or trade server but also changes of the order state when placing it (for example, from ORDER_STATE_STARTED to ORDER_STATE_PLACED or from ORDER_STATE_PLACED to ORDER_STATE_PARTIAL etc.).
TRADE_TRANSACTION_ORDER_DELETE
Deletion of an order from the list of open orders. Orders can be deleted from the list of the open ones as a result of a trade request or as a result of execution (filling) and transferring to history.
TRADE_TRANSACTION_DEAL_ADD
Adding a trade to the history. Carried out as a result of an order execution or an account balance operation.
TRADE_TRANSACTION_DEAL_UPDATE
Changing of a deal in the history. It is possible situations when a previously executed deal is changed on the server. For example, the trade was changed in the external trading system (exchange), where it was moved by the broker.
TRADE_TRANSACTION_DEAL_DELETE
Deletion of the trade from the history. There may be situations when a previously executed deal is deleted on the server. For example, the trade was deleted in the external trading system (exchange), where it was removed by the broker.
TRADE_TRANSACTION_HISTORY_ADD
Adding an order to the history as a result of execution or cancellation.
TRADE_TRANSACTION_HISTORY_UPDATE
Changing of an order located in the order history. This type is intended for expanding the functionality on the trade server's side.
TRADE_TRANSACTION_HISTORY_DELETE
Deletion of an order from the order history. This type is intended for functionality expansion on the trade server's side.
TRADE_TRANSACTION_POSITION
Change of a position not related to trade execution. This transaction type indicates that the position has been changed on the trade server side. The position's volume, opening price, as well as Stop Loss and Take Profit levels may be changed. Information about changes is transmitted to the MqlTradeTransaction structure through the OnTradeTransaction handler. A position change (addition, modification or elimination) as a result of a trade does not cause TRADE_TRANSACTION_POSITION transaction.
TRADE_TRANSACTION_REQUEST.
Notification that a trade request is processed by the server and the result is received. For transactions of this type it is necessary to analyze only one field - type (transaction type) in MqlTradeTransaction structure. The second and third parameters of OnTradeTransaction function (request and result) must be analyzed to get more information.
Unless the highlighted event is not generated. So, who needs it?
Such as from this list?
Trade event is my term.
Forum on trading, automated trading systems and trading strategies testing
Features of mql5 language, subtleties and tricks
fxsaber, 2017.02.28 19:30
There may be an open BUY position and an active BUY order. Above gave a code example, but probably easier on the fingers. How does TP of an open position trigger?
Trade-event is my term.
In my opinion this is not an event. It is the subtleties of the order execution sequence. Why should I catch the moment when a SELL order to close a BUY position is in the terminal simultaneously with the position itself?
It may be a misfortune that the sequence of events may not be adhered to, but ... What is the main thing in trading? If they open a position for me even tomorrow, but at a stated price, and close it even yesterday, but with a profit, I will not object.
In my opinion, this is not an event. It is the subtleties of the order execution sequence. Why should I catch the moment when a SELL order to close a BUY position is in the terminal at the same time as the position itself?
Read the title of the thread.
What will change?