breakeven ea mt4 platform

 
I would like fairly simple EA that will move my take profit to 0 when my option goes -3 pips in the negative 
 
You need to cycle all your orders, compare Ask/Bid with OrderOpenPrice(), then set OrderTakeProfit() to 0 in case it isn't already that.
 
Fabio Cavalloni:
You need to cycle all your orders, compare Ask/Bid with OrderOpenPrice(), then set OrderTakeProfit() to 0 in case it isn't already that.
void be()
  {
   if(b_start<=0)
      return;
   bool check=true;
   int cnt=OrdersTotal();
   double stop=MarketInfo(Symbol(),MODE_STOPLEVEL);
//---
   for(int i=0; i<cnt; i++)
     {
      if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
         continue;
      else
         if(OrderSymbol()==Symbol() )
           {
            if(OrderType()==OP_BUY && Bid-b_start*Point>OrderOpenPrice())
              {
               double NewTP=NormalizeDouble(OrderOpenPrice(),Digits());
               if(NewTP>OrderTakeProfit() || OrderTakeProfit()==0)
                 {
                  if(Bid-(stop)*Point>OrderOpenPrice())
                    {
                     check=OrderModify(OrderTicket(),OrderOpenPrice(),NewTP,OrderTakeProfit(),0,clrGreen);
                     if(!check)
                        Print("BE modify TP error : ",GetLastError());
                    }
                 }
              }
            if(OrderType()==OP_SELL && Ask+b_start*Point<OrderOpenPrice())
              {
               double NewTPS=NormalizeDouble(OrderOpenPrice(),Digits());
               if(NewTPS<OrderTakeProfit() || OrderTakeProfit()==0)
                 {
                  if(Ask+(stop)*Point<OrderOpenPrice())
                    {
                     check=OrderModify(OrderTicket(),OrderOpenPrice(),NewTPS,OrderTakeProfit(),0,clrRed);
                     if(!check)
                        Print("BE modify TPerror : ",GetLastError());
                    }
                 }
              }
           }
     }
  }
 
IS IT RIGHT ?
 
Oussama Mansour:
IS IT RIGHT ?

Please do not post in capital letters, it is bad netiquette and considered shouting and rude.

Reason: