How to update Stop and Limit pending order prices?

 
I would like to make the following two changes to the EA in the attached MQL4 file.


(1) In the case where this EA already has a pending Stop order or Limit order due to an EntrySignal,

If the EntrySignal is raised again when the bar is newly opened,
I want to cancel a pending order with the same magic number, symbol, same Buy or Sell direction and send a new order price STOP, LIMIT pending order.


(2) For example, if a Buy-Stop pending order is valid and has not yet expired, the Sell-Stop pending order will not be sent even if a Sell-Stop signal occurs.
I want to send a pending Sell Stop order even if the buy Stop pending order is still valid.
The same is true if there is a pending Sell-Stop order first.
The same is true for Limit orders.

Could you please provide the attached MQL4 file with the above two changes added?

Thank you.

Files:
 
  • Please don't create topics randomly in any section. It has been moved to the section: MQL4 e MetaTrader 4
  • Usually people who cannot code do not receive free help on this forum, although it could happen. Be patient.
  • If you show your attempts and describe your problem clearly, you will most probably receive an answer from the community. Use the CODE button (Alt-S) when inserting code.
  • If you do not want to learn to code, that is not a problem. You can either look at the Codebase if something free already exists, or in the Market for paid products (also sometimes free).
  • Finally, you also have the option to hire a programmer in the Freelance section.
 

There is no need to create pending orders in code.

  1. The pending has the slight advantage, A) you are closer to the top of the queue (filled quicker), B) there's no round trip network delay (filled quicker.)

    Don't worry about it unless you're scalping M1 or trading news.

  2. Humans can't watch the screen 24/7, so they use pending orders; EAs can, so no need for pending orders, have it wait until the market reaches the trigger price and just open an order.

Reason: