Can a professional pls tell me why this EA won't work?

 
#include <stdlib.mqh>
#include <WinUser32.mqh>

double balance,cp;
int total;
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
 
int init(){balance=AccountBalance();}
 
int start() 
      {
      for(int i=OrdersTotal()-1; i>=total; i--)
      {
      if(AccountEquity()>=AccountBalance()*1.2 || AccountEquity()<=AccountBalance()*0.8)return(1);
      {
       while(true)
         if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && (cp==MarketInfo(OrderSymbol(),MODE_ASK))&&(OrderType()==OP_SELL))
            {OrderClose(OrderTicket(),OrderLots(),cp,0,CLR_NONE); }continue;
     
         if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && (cp==MarketInfo(OrderSymbol(),MODE_BID))&&(OrderType()==OP_BUY))
            {OrderClose(OrderTicket(),OrderLots(),cp,0,CLR_NONE); }continue;
        
         if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && (OrderType()>OP_SELL))
            {OrderDelete(OrderTicket());} 
            {break;
            Sleep(10000);
            RefreshRates();
        }
     }
  }
  //----
   balance = AccountBalance(); // new starting point for future trades
      return(0);
  }

//+------------------------------------------------------------------+

It is meant to close all open and pending trades when the condition is fulfilled.
 
cp is never set & always is 0.
 
LesioS:
cp is never set & always is 0.
That's right, LesioS. Actually the uninitialized variable has empty value, which is equal to 2147483647.
 
janklimo:
LesioS:
cp is never set & always is 0.
That's right, LesioS. Actually the uninitialized variable has empty value, which is equal to 2147483647.
Thanks LesioS & janklimo, I am yet to try it out.

Regards.
Reason: