Close all pending when first order go Stop Loss

 

Hi guys, I'm new on this forum.


I have an EA that under certain conditions opens multiple buy or sell orders, the first to market, the others are pending. I want that if the first market order goes to stop loss, all other pending orders are automatically closed. Can someone help me? I guess it must use the magic number


i use MT4, I don't know if it's correct to post the topic here

Sorry for my bad english 

 
hi, create new order in "Freelance" section. Regards Greg
 
Luca De Andrea: I want … help me?

i use MT4, I don't know if it's correct to post the topic here

I guess it must use the magic number

  1. You posted your MT4 question in MQL4 section, (bottom of the Root page?) or it has already been moved there.
              General rules and best pratices of the Forum. - General - MQL5 programming forum

  2. Once one order opens, monitor your open orders count. If there aren't any then delete all pending.

  3. Magic number just allows you to identify the EA's orders from all others. Using OrdersTotal/OrdersHistoryTotal (MT4) or PositionsTotal (MT5), directly and/or no Magic number filtering on your OrderSelect/Position select loop means your code is incompatible with every EA (including itself on other charts and manual trading.)
              Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 programming forum
              MagicNumber: "Magic" Identifier of the Order - MQL4 Articles

  4. Stop guessing. Learn to code it.

  5. Help you with what? You haven't stated a problem, you stated a want.

    Show us your attempt (using the CODE button) and state the nature of your problem.
              No free help
              urgent help.

    Or pay someone. Top of every page is the link Freelance.
              Hiring to write script - General - MQL5 programming forum

Reason: