help with this close all open order once order is modified

 

please can some one help me with this script code,i have try everything yet not yet fix please i want this code to close all my open order one order is modified ,my code......thanks






extern int tp= 200;



int start()
{
double spread=Ask-Bid;

 int Ticket=OrderTicket();                            // Security name
 for( Ticket = OrdersTotal()-1;  Ticket >= 0 ;  Ticket--)
    {
 if(OrderSelect(Ticket,SELECT_BY_POS, MODE_TRADES)==true)
       if(OrderSymbol()!=Symbol()) // with current chart symbol 
       continue; 
{
if (OrderType() == OP_BUY && iMA(NULL,0,1,0,MODE_LWMA,PRICE_LOW,0) > OrderOpenPrice()) {
OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),OrderOpenPrice()+tp*MarketInfo(OrderSymbol(),MODE_POINT),0,Green);}
 OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Yellow );
}          
if (OrderType() == OP_SELL && iMA(NULL,0,1,0,MODE_LWMA,PRICE_HIGH,0) < OrderOpenPrice()) {
OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),OrderOpenPrice()-tp*MarketInfo(OrderSymbol(),MODE_POINT) + spread,0,Green);}
 OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Yellow );
}
return;
}//+------------------------------------------------------------------+
 
please anybody with ideal on how to fix this script,
 
please am still waiting
 
What seems to be the problem? What errors are you getting?
 
Filter:
What seems to be the problem? What errors are you getting?




thanks Filter: for more than one month now i have been looking for solution but i fix it to night with my hands thanks for you attention. in recommendation

of your instruction i will learn to code in error code for checks and possible corrections,

 
No problem mate, glad you got it sorted :)
Reason: