How to close all opened order and all pending order if one of the opened order is already take profit?
Do you really want to close the one order that is one pip in profit? Anyway something like this:for(int inProfit = OrdersTotal()-1; pos >= 0 ; pos--) if ( OrderSelect(inProfit, SELECT_BY_POS) // Only my orders w/ && OrderMagicNumber() == magic.number // my magic number && OrderSymbol() == Symbol() // and symbol && OrderProfit() > 0 ){ CloseAll(); break; } ... void CloseAll(){ for(int pos = OrdersTotal()-1; pos >= 0 ; pos--) if ( OrderSelect(pos, SELECT_BY_POS) // Only my orders w/ && OrderMagicNumber() == magic.number // my magic number && OrderSymbol() == Symbol() ){ // and symbol if (OrderType()< OP_SELL) OrderClose(OrderTicket(), OrderLots(), OrderClose(), Slippage.Pips*pips2points, Aqua ); else OrderDelete(OrderTicket()); } }

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi Guys,,apologize me if my english is bad,,I'm from Indonesia,,and I want to make an EA but I got the problem
How to close all opened order and all pending order if one of the opened order is already take profit?
I'm very appreciate for all the forum to help me :D thanks.