Why do you need to update the magic number of an order?
I would like use magic number to identify whether a buy order has sell stop order or stoploss.
File fucntions are "group of functions for working with files", I'm now talking about relationship between "orders". So what's your point?
You don't. The mq4 model is to have a TP and SL as PART of the order. Opposing orders will NOT work, one will close and the other will continue. FX is not stocks.
Opposing orders WILL work, depending on where you are in the world. I can open opposing orders on the same pair just fine using MT4. This will NOT work in the US due to regulation and will also not work on MT5 as the ability has been removed.
I have just done an experiment: sell 0.2 lots, buy 0.1 lots. I still have 2x open trades. The buy did not subtract 0.1 lots from the already open sell for a net of 0.1. I still have net outstanding positions of 0.3 lots.
The behaviour that you describe is dependent on a number of factors so I would not rely on it. Also remember that there is the whole rest of the world to consider outside of the US.
I thought that placing a buy and a sell at the same time was called Hedging.
Not all brokers allow hedging.
One hedging stratergy would be to arrage a a sell to open on a buy trade to stop the buy trade from losing too much but should the price return to near buy trade acceptable loss area the hedging sell could be closed with a small profit. For this you would have to know which buy trade was associated with which sell trade.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear all
How can I let EA know order A is the stop order of order B?
If I need EA to search all orders which have its stop order, and replace them with stoploss, how? (I tried to use magic number but I can't as it can't be updated)
Thanks for your kind help.
wing