//+------------------------------------------------------------------+
//|             Copyright © 2010, Konstantin http://www.fxaktiv.com  |
//|                        panelektrik@yandex.ru skype pan--elektrik |
//|                                ISQ 561090193 Ìîá.+380 50 7115118 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, Konstantin http://www.fxaktiv.com  panelektrik@yandex.ru"
#property link      "http://www.fxaktiv.com  panelektrik@yandex.ru  skype pan--elektrik ISQ 561090193"
#property show_inputs

 extern int Magic = 6543532;
//+------------------------------------------------------------------+
 int orders(){int j=0;for(int i=0;i<OrdersTotal();i++){if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true&&OrderMagicNumber()==Magic)
 if(OrderType()==OP_BUYSTOP||OrderType()==OP_BUYLIMIT||OrderType()==OP_SELLSTOP||OrderType()==OP_SELLLIMIT)j++;}return(j);}
//+------------------------------------------------------------------+
 int ALLClose(){RefreshRates();for(int i=OrdersTotal(); i+1>=0; i--){
 if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true&&OrderMagicNumber()==Magic){
 if(OrderType()==OP_BUYSTOP||OrderType()==OP_BUYLIMIT||OrderType()==OP_SELLSTOP||OrderType()==OP_SELLLIMIT)OrderDelete(OrderTicket());}}}
//+------------------------------------------------------------------+
int start()
{
 bool condition=true;
 while(condition)
 {
 ALLClose();
 if(orders()==0){PlaySound("Wait.wav");break;}
 Sleep(1000);
 }
}
//+------------------------------------------------------------------+