Questions from Beginners MQL5 MT5 MetaTrader 5 - page 215

 
Algo:

Please advise. The EA executes a trade from the market by sending OrderSend(), StopLoss and TakeProfit are set immediately. How can I further determine which one triggered when a Stop or a TakeProfit is triggered? I.e. how do I find the trade (there may be many of them, as other EAs may trade on the same symbol) among allhistorical trades (StopLoss or TakeProfit) which triggered as a result of triggering of a closing order? These trades have zero magic value and there is no way to identify it... We may know the ticket of the order which resulted in the trade, but we do not know the stoploss and takeprofit values beforehand. Or is there some way to identify them? Well, I need to trace the state of a trade opened using the order with the so-and-so's ticket - whether the stop or profit set simultaneously with its opening was executed, and if so, what exactly was executed and what was the financial result. How do I do this? Is this even possible in MT5?

https://www.mql5.com/ru/articles/644
Рецепты MQL5 - История сделок и библиотека функций для получения свойств позиции
Рецепты MQL5 - История сделок и библиотека функций для получения свойств позиции
  • 2013.04.18
  • Anatoli Kazharski
  • www.mql5.com
Пришло время подвести краткий итог по материалам предыдущих статей о свойствах позиции. В этой статье мы создадим несколько дополнительных функций для получения тех свойств, которые можно получить только после обращения к истории сделок. Мы также познакомимся со структурами данных, что сделает доступ к свойствам позиции и символа еще удобнее.
 
Algo:

Please advise. The EA executes a trade from the market by sending OrderSend(), StopLoss and TakeProfit are set immediately. How can I further determine which one triggered when a Stop or a TakeProfit is triggered? I.e. how do I find the trade (there may be many of them, as other EAs may trade on the same symbol) among allhistorical trades (StopLoss or TakeProfit) which triggered as a result of triggering of a closing order? These trades have zero magic value and there is no way to identify it... We may know the ticket of the order which resulted in the trade, but we do not know the stoploss and takeprofit values beforehand. Or is there some way to identify them? Well, I need to track the state of a trade opened using the order with the so-and-so's ticket - whether the stop or profit set simultaneously with its opening was executed, and if so, what exactly was executed and what was the financial result. How do I do this? Is this even possible in MT5?

When trading robots in MT5, and if several robots are trading the same symbol, better forget about using StopLoss and TakeProfit. Instead, it is better to use pending orders and cancel the second one while waiting for the first one to execute. Otherwise, if you have several robots trading the same instrument at the same time, all of them will be "merged" into 1 common position with only 1 stop and 1 take.
 

I've read it, thanks of course, but it doesn't answer my question.

Anyway, my understanding is that this is not possible in MT5 at all. The only thing I can think of is to search for a deal opening on a magic number, watch its time, and then check if the price has crossed stop or profit levels after the deal opening, and if it has, whether there was an opposite deal with a zero magic number with the same lot on the same bar. It is an extremely clumsy variant. ) And the main thing - unreliable. But nothing better comes to mind...

 
micle:
When trading robots in MT5, if several robots trade with the same symbol, better forget about using StopLoss and TakeProfit. Instead, you'd better use pending orders and, waiting for the first one to execute, cancel the second one. Otherwise if you have trades from several robots on 1 instrument at the same time, they will all be "merged" into 1 common position which will only have 1 stop and 1 take.

If there were no breakdowns and other minor force majeure, this would be a great way out. But here the "would" gets very much in the way. )))

Ok, thanks for the answers.

 
Algo:

If there were no breakdowns and other minor force majeure, this would be a great way out. But here the "would" gets very much in the way. )))

OK, thanks for the answers.

There is a concept of VPS. I, on the other hand, have my own personal "pps")) with power backup and 2 different ISPs.
 
Algo:

If there were no breakdowns and other minor force majeure, this would be a great way out. But here the "would" gets very much in the way. )))

OK, thanks for the answers.

An alternative might be as follows. To put a pendulum only stop or only take. The second component will be a robot every tick. But personally I am much more satisfied with 2 pendants.
 
micle:
There is a concept of VPS. look that way. I, on the other hand, have my own personal "vps")) with backup power and 2 different ISPs.

I'm looking at guaranteed security, not the UPU, which I already have. ) It only reduces the risk of force majeure, but does not eliminate it completely. In MT4 the risk is completely eliminated, the worst that can happen is that another order will not open. But you do not have to worry about open positions with stops set.

micle:
The second component is a robot that grazes every tick.

This is not an alternative, it's the same in profile. ) See the previous paragraph. ))

 
Algo:

I'm looking at guaranteed security, not the UPU, which I already have. ) It only reduces the risk of force majeure, but does not eliminate it completely. In MT4 the risk is completely eliminated, the worst that can happen is that another order will not open. But you do not have to worry about open positions with stops set.

This is not an alternative, it is the same in profile. ) See previous paragraph. ))

To each his own. What matters to me is an adequate tester, which is present in MT5.
 
Algo:

I'm looking at guaranteed security, not the UPU, which I already have. ) It only reduces the risk of force majeure, but does not eliminate it completely. In MT4 the risk is completely eliminated, the worst that can happen is that another order will not open. But you do not have to worry about open positions with stops set.

This is not an alternative, it is the same in profile. ) See previous paragraph. ))

If you have a real pending stop order, it is guaranteed to trigger whether your robot is running or not. In this, MT5 is as reliable as MT4.
 
C-4:
If you have a real pending stop order, it is guaranteed to trigger whether your robot is running or not. In this, MT5 is as reliable as MT4.
But the opposite order will not cancel if there is no connection. This is the whole problem.
Reason: