Hi there,
I understand that things work a little different in MT5…
Here is my understanding: An order results in a deal. A deal effects the net position. StopLoss (SL) and TakeProfit (TP) are on position level.
What I need is that, as in MT4, I can set SL and TP based on deal level. Having an open position, when I add to the position, I need the two separte “operations” to be managed individually.
I can do this by opening Stop and Limit orders, which reflect the individual SL and TP and delete the second pending order once the first one has been filled. I have created a small library for myself, which does exactly that (which I am willing to share).
I am just wondering, whether this is not an issue that everyone of us has. I would assume that this is an already solved issue. However searching articles and code base, I did not find much.
What I did find are the following two related promiding articles, which provide a framework for individual trade management incl. hedging:
https://www.mql5.com/en/articles/1297#c2_4
https://www.mql5.com/en/articles/1316#c1_1
However, considering the limited number of comments and the date of the articles it feels as if this is not the common way how to deal with this challenge.
So my question to you is:
If you write an EA which is supposed to handle SL and TP individually per order/deal, how do you go about it?
Do you use an existing framework and if you do, which one?
Thanks,
Matt