Modifying trades

 
Has anyone had the situation where a trade is placed with a TP and later a second trade is placed, of the same type, also with a TP. Because of FIFO both trades have the same TP. The problem is that the TP of the second trade pulls back the TP of the first trade causing it to become at a loss or very little gain. Is there a way to use OrderModify() to set the TP of two same trades to the highest value, of the two, when they are BUY orders and lowest of the two, when SELL?
 

" the TP of the second trade pulls back the TP of the first trade"

???

 

08:06:37 '925198': instant order sell 1.00 EURUSD at 1.45395 sl: 0.00000 tp: 1.45376
08:06:37 '925198': request was accepted by server
08:06:38 '925198': request in process

.
08:06:38 '925198': order was opened : #9942185 sell 1.00 EURUSD at 1.45395 sl: 0.00000 tp: 1.45376

.

08:06:40 '925198': instant order sell 1.00 EURUSD at 1.45398 sl: 0.00000 tp: 1.45379
08:06:40 '925198': request was accepted by server
08:06:40 '925198': request in process

.
08:06:40 '925198': order was opened : #9942187 sell 1.00 EURUSD at 1.45398 sl: 0.00000 tp: 1.45379

.

Because of FIFO, the TP of the first SELL was changed to 1.45379 and I had to manually change it back.

.

08:08:18 '925198': modify order #9942185 sell 1.00 EURUSD at 1.45395 sl: 0.00000 tp: 1.45379 -> sl: 0.00000 tp: 1.45376
08:08:18 '925198': request was accepted by server
08:08:18 '925198': request in process

.

.

When I change the TP of a trade ( doesn't matter which one I change ) the TP of both trades are made the same.

.

.

What I need is to be able to change the TP of both trades to the lowest value for a SELL, and the highest value, for a BUY.

.

.

Wasn't sure if OrderModify() would be the best way to accomplish this or if there was an easier way.

 

Interesting side effect of the FIFO thing...

OrderModify() is the only way to change orders after submitted.

 

Modify the TP of the open order(s) before opening a new order

 
Yellowbeard wrote >>

08:06:37 '925198': instant order sell 1.00 EURUSD at 1.45395 sl: 0.00000 tp: 1.45376
08:06:37 '925198': request was accepted by server
08:06:38 '925198': request in process

.
08:06:38 '925198': order was opened : #9942185 sell 1.00 EURUSD at 1.45395 sl: 0.00000 tp: 1.45376

.

08:06:40 '925198': instant order sell 1.00 EURUSD at 1.45398 sl: 0.00000 tp: 1.45379
08:06:40 '925198': request was accepted by server
08:06:40 '925198': request in process

.
08:06:40 '925198': order was opened : #9942187 sell 1.00 EURUSD at 1.45398 sl: 0.00000 tp: 1.45379

.

Because of FIFO, the TP of the first SELL was changed to 1.45379 and I had to manually change it back.

.

08:08:18 '925198': modify order #9942185 sell 1.00 EURUSD at 1.45395 sl: 0.00000 tp: 1.45379 -> sl: 0.00000 tp: 1.45376
08:08:18 '925198': request was accepted by server
08:08:18 '925198': request in process

.

.

When I change the TP of a trade ( doesn't matter which one I change ) the TP of both trades are made the same.

.

.

What I need is to be able to change the TP of both trades to the lowest value for a SELL, and the highest value, for a BUY.

.

.

Wasn't sure if OrderModify() would be the best way to accomplish this or if there was an easier way.

Hi Yellowbeard

I noted that the distance between the entry and the tp is 19 points (less than 2 pips) in both cases. While not my problem how much you are trying to gain per trade, I am wondering if the distance is not maybe determiined by the minimum allowed by your broker. So my question is, do you intend to take only 19 points. If your answer is NO then maybe the problem is with the calculation of your tp.

My EAs will automatically change the entry point or trade type to prevent attempting a trade within minimum allowed distance (MODE_SPREAD and MODE_STOPLEVEL). The intention is to avoid error 130. WHat your are seeing is typically who my EAs will act so I was wondering if you have something similar. If you add to that a calculation error with the tp, your problem is explained.

Just a thought.

whocares

Reason: