pls anything wrong with this code?

 

Pls i want the EA which the code is attached below to be locking profit when the profit get to 15pips its should lock in to 10 and when it get to 35 its should also lock it to 30pips. But unfortunately for me, it is the first one that work( 15pips locked to 10pips) the 35pips to 30 didn't work .When the profit got to 40pips it has to come back to 10 when its closed and that is not the way i want it . Pls assist me .Thanks

//+------------------------------------------------------------------+
//| Easy |
//| |
//| |
//+------------------------------------------------------------------+

extern double Lots=0.1;
extern double TakeProfit=60;
extern double TakeProfit1=35;
extern double TakeProfit3=120;
extern double TrailingStop2=31;
extern double StopLoss2 = 30;
extern double TrailingStop=60;
extern double StopLoss=80;
extern bool METHODA=true;
extern bool New_Bar=false;
extern bool OneOrderperpair=true;
extern bool TradeAllowed=true;
extern int BreakEven=10;
extern bool ManageMoney = true;
extern int Risk=1;
extern int stoplossbars =15;

int start()
{

Easy();
Pips();
Fun_New_Bar();
if(New_Bar==false)
return;
if(ManageMoney==true) Lots = LotSize();
return(0);
}

double LotSize(){
double lotMM = MathCeil(AccountFreeMargin() * Risk / 1000)/10;
if (lotMM < 0.01) lotMM = Lots;
if (lotMM > 1.0) lotMM = MathCeil(lotMM);
if (lotMM > 50) lotMM = 50;
return (lotMM);
}
void Fun_New_Bar()
{
static datetime New_Time=0;
New_Bar=false;
if(New_Time!=Time[0])
{
New_Time=Time[0];
New_Bar=true;
}
}
int buy,sell,i,wait=0,waits=0;
int Easy()
{ double sl;
buy=0;sell=0;
for(int i=0;i<OrdersTotal();i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderType()==OP_BUY ){buy=1;}
if(OrderType()==OP_SELL ){sell=1;}
}

double ema5 =iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,1);
double ema55 =iMA(NULL,0,55,0,MODE_EMA,PRICE_CLOSE,1);
double ema21 =iMA(NULL,0,21,0,MODE_EMA,PRICE_CLOSE,1);
double rsi=iRSI(NULL,0,15,PRICE_CLOSE,1);
double main=iADX(NULL,0,30,PRICE_CLOSE,MODE_MAIN,1);

double plusDi=iADX(NULL,0,30,PRICE_CLOSE,MODE_PLUSDI,1);

double minusDi=iADX(NULL,0,30,PRICE_CLOSE,MODE_MINUSDI,1);

double plusDii=iADX(NULL,0,30,PRICE_CLOSE,MODE_PLUSDI,2);

double minusDii=iADX(NULL,0,30,PRICE_CLOSE,MODE_MINUSDI,2);


double pb=iSAR(NULL,0,0.01,0.1,0);


if(METHODA==true)
{
if(plusDii<minusDii&&plusDi>minusDii&&main>15&&rsi<70&&rsi>30&&ema5>ema21&&ema21>ema55&&pb<Close[0]&&New_Bar==true&&OneOrderperpair&&TradeAllowed&&buy==0)
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit3*Point,"Femi",0,0,Red);
wait=0;
}
}

/******************************************************************************************************************************************/

if(METHODA==true)
{
if(plusDii>minusDii&&plusDi<minusDi&&main>15&&ema5<ema21&&ema21<ema55&&rsi<70&&rsi>30&&pb>Close[0]&&New_Bar==true&&OneOrderperpair&&TradeAllowed&&sell==0)
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+StopLoss*Point,Bid-TakeProfit3*Point,"Femi",0,0,Red);
waits=0;
}
}


/******************************************************************************************************************************************/
}

int Pips()
{



for( i=1; i<=OrdersTotal(); i++)
{
if (OrderSelect(i-1,SELECT_BY_POS)==true)
{
if(OrderType()==OP_BUY && OrderTakeProfit()>50&&Close[1]<Open[2]&&OrderSymbol()==Symbol())
{
OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet);
}
}







/**********************************************************************************************************************************/

if (OrderSelect(i-1,SELECT_BY_POS)==true)
{
if(OrderType()==OP_SELL &&OrderTakeProfit()>50&&Close[1]>Open[2] &&OrderSymbol()==Symbol())
{
OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet);
}
}


}


for( int i=0; i < OrdersTotal(); i++){
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderType()==OP_BUY && OrderSymbol()==Symbol() )
{
if (Ask>=OrderOpenPrice() + stoplossbars*Point &&
OrderOpenPrice() > OrderStopLoss())
{
OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() + BreakEven * Point, OrderTakeProfit(), Green);
}
}

if(OrderType()==OP_BUY && OrderSymbol()==Symbol() )
{
if (Ask>=OrderOpenPrice() + TakeProfit1*Point &&
OrderOpenPrice() > OrderStopLoss())
{
OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() + TrailingStop2 * Point, OrderTakeProfit(), Green);
}
}


if(OrderType()==OP_SELL && OrderSymbol()==Symbol())
{
if (Bid <=OrderOpenPrice() - stoplossbars*Point &&
OrderOpenPrice() < OrderStopLoss())
{
OrderModify(OrderTicket(), OrderOpenPrice(),OrderOpenPrice() - BreakEven*Point, OrderTakeProfit(), Blue);
}
}

if(OrderType()==OP_SELL && OrderSymbol()==Symbol())
{
if (Bid <=OrderOpenPrice() - TakeProfit1*Point &&
OrderOpenPrice() < OrderStopLoss())
{
OrderModify(OrderTicket(), OrderOpenPrice(),OrderOpenPrice() - TrailingStop*Point, OrderTakeProfit(), Blue);
}
}
}
}


 

At a glance the order modyfy conditions are not unique so the break even will always be done. It might work if you do the bigger profit test first then the break even test but it would be better to make the conditions unique using a range test.

IF breakeven < X < profit

PS try posting your code with the SRC button up there ^