When TakeProfit than delete pending order from same day when order was ordered.

 

Hello,

 

I need to write code for this. Every day I open two positions. One for BUY one for SELL. I set up T/P and S/L for both of them. I repeat this every day. I need to detect when is event of T/P from day 1, that pending order no.2 will be deleted. For example:

1st day: order BUY1, order SELL1

2nd day: TP BUY1, SELL1 delete, order BUY 2, order SELL2 

3rd day: order BUY 3, order SELL 3

4th day: TP SELL2, BUY2 delete, order BUY 5, order SELL 6,  BUY3 and SELL3 without changes....

 

and so on...

 

Please help me :( 

 
patrichky: I need to write code for this.  Please help me 
  1. learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
  2. Specifically, OrderSelect loop to find the one pending order. OrderSelect loop on history to find the last closed order.