if TP is hit do this and this

 
hi sir I want to know if it is possible on MQL4 to code a function that will close my trade and delete my order at the same time if a Take profit target with the given magic number is hit? is Yes, what should I do?  thank you so much.
 
  1. Of course, it is. Instead, you can set the TP, the order will close itself. You don't delete open orders, only pending orders.
  2. Code it.

    MT4: Learn to code it.
    MT5: Begin learning to code it.

    If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.

  3. or pay (Freelance) someone to code it. Top of every page is the link Freelance.
              Hiring to write script - General - MQL5 programming forum (2019.08.21)

We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
          No free help (2017.04.21)

 
William Roeder:
  1. Of course, it is. Instead, you can set the TP, the order will close itself. You don't delete open orders, only pending orders.
  2. Code it.

    MT4: Learn to code it.
    MT5: Begin learning to code it.

    If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.

  3. or pay (Freelance) someone to code it. Top of every page is the link Freelance.
              Hiring to write script - General - MQL5 programming forum (2019.08.21)

We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
          No free help (2017.04.21)

Thank you Sir William Roeder. 

1. oh yes that is what I mean delete pending orders and close all open trades when I my TP is hit,
2. i think i can code it but I dont know the logic to use hehe