the mql function OrderSend() can return a unique ticket number after every order opened.
you can only select one order of this ticket and modify it's SL and TP.
maybe you need to do some coding yourself.
Understood, but my intention isn't modify SL and TP of an opened position (which your suggestion fits great).
My intention is to open a new position for the same _Symbol. The positions have different EA_MagicNumber, so it can be used to avoid mixing EA conditions.
Each EA, despite running on same _Symbol, will have its own position.
You can open two charts for one symbol and then you must change magic numbers for each EA
Do you have something working in this way or was it a guess?
Because I have two charts opened, each one with an EA and EAs have different magic number. When a position was open for EA1 and there is a new signal for EA2, EA2 add bought quantity to EA1's position, price is weighted average and EA1's SL and TP are overwritten by EA2.
Please, share your code if you have something working like you suggested.
look if you have an "OrderModify" somewhere
CTrade.OrderModify() states: Modifies the pending order parameters.
Please, correct-me if I am wrong, but considering the open order was filled, it became a position. A position can have a SL and TP, but it does not mean this position has a pending order. When price reaches SL or TP, then a order is deployed.
AFAIK, if there is no pending order until SL or TP are reached, can't use OrderModify.
![Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Order Properties Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Order Properties](https://c.mql5.com/36/38/documentation-on-mql5-constants__60.png)
- www.mql5.com
This article states for each account, for every financial instrument, there can be only one position. For each symbol, at any given time, there can be only one open position - long or short.
So, this problem was solved checking orders history and placing new orders according to each EA's exit rules. In my case, all orders placed are GTC (good till cancel).
Hope MetaTrader team changes this restriction and allow us to have multiple position for the same financial instrument.
![Orders, Positions and Deals in MetaTrader 5 Orders, Positions and Deals in MetaTrader 5](https://c.mql5.com/36/39/orders-positions-and-deals-in-metatrader.jpg)
- www.mql5.com
This article states for each account, for every financial instrument, there can be only one position. For each symbol, at any given time, there can be only one open position - long or short.
So, this problem was solved checking orders history and placing new orders according to each EA's exit rules. In my case, all orders placed are GTC (good till cancel).
Hope MetaTrader team changes this restriction and allow us to have multiple position for the same financial instrument.
For several years now, MetaTrader 5 has been able to open two types of trading accounts: netting - there can be only one position on one symbol and hedge - there can be several positions on one symbol.
For several years now, MetaTrader 5 has been able to open two types of trading accounts: netting - there can be only one position on one symbol and hedge - there can be several positions on one symbol.
Excellent. Find out that my account is NETTING.
Already requested to my broker if it is possible to change.
Thanks for your clear answer.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello folks,
Every time my EA receive a tick and validate as a buy signal, it executes:
The problem: if I already have an opened position for same symbol, the method above changes TP and SL of all positions.
My intention is to open a new position, for same symbol, but do not change SL e TP of previous buy.
Expert Magic is already set, but since it is the same EA on same symbol, it is changing SL and TP since
Also tried with PositionOpen method
but returns error 4014
Any idea on how to independently work with multiple positions using same EA and same symbol?
Thanks