Features of the mql5 language, subtleties and tricks - page 21
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
I'm not doing anything yet. Even in mql4 I found it useless to look through the history of orders. And here I'm still fantasizing in what direction I would start digging if necessary. A little earlier, I said that I could not check it for the simple reason: I have no trailed positions in any terminal and do not want to do it specially.
Accordingly, after closing the position, there are only 2 orders and 2 deals referring to the position on my accounts. Using them, we may get at least some information about the position. For example, at what price the request was opened and at what exactly it was opened. Accordingly, it is easily determined by the slippage at which the position was opened.
I treat the commentary with caution since MT4 because there were cases when brokerage companies wiped the comments according to their own reasons.
I see, you are guessing, I have a proven solution.
Moderator Artem, unnecessary posts, and some of mine too, can already be annihilated.
In general, of course, it's difficult to quickly switch to the logic of the MT5 order system after the four.
Start writing the MT4->MT5 converter, and everything will fall into place. That's how I got a very good understanding of what things can ONLY MT4, what things can ONLY MT5, what things can none of them.
For example
I see, on the level of conjecture you have, and I gave a proven solution.
Moderator Artem, unnecessary posts, and some of mine too, can already be annihilated.
There is no need to do it on a guessing level. I determine everything for myself at the moment of position opening/closing from function OnTradeTransaction() and there is no need to look through the history to find the last closed/open position.
I see, on the level of conjecture you have, and I gave a proven solution.
Moderator Artem, unnecessary posts, and some of mine too, can already be annihilated.
Why delete? It's a normal discussion - everything is on topic.
And then the question arises: is it always possible to get the right information in time? Especially after reading the help...
For example, I can use OrderSendAsync() in forex, but not always. But for Forex, so far I always get it when OnTradeTransaction event occurs. It is absolutely easy to detect position opening, pending order activation and position closing. Here a counter question arises: Is it necessary to search through the history for the last closed position if we can catch the very fact of closing?
First, why search through the history, if the position was last closed? No one ever looks for, for example, the "last" element of the array.
Second, the question was about the way to determine whether a position is closed on SL or TP. At the moment, the most adequate and most reliable way is reading the comment. In addition, the argument that a broker can change the comment relating to SL and/or TP is at the level of fiction, I have not met examples of such brokers, neither personally, nor by hearsay from anyone. i.e. someone somewhere hears something from someone, but no one has personally seen the fact.
OnTradeTransaction() is not guaranteed, it means that it can be used as an information source, and nothing more. Not a tool for management and decision making in trade transactions.
***
OnTradeTransaction() is not guaranteed, **
Outdated information. The phrase that this event is not guaranteed has already been removed from the help.
Outdated information. The phrase that this event is not guaranteed has already been removed from the reference.