can someone help me "ea"

To add comments, please log in or register
Jackova
8
Jackova  

hi everone i hope you have nice day i write code in mql4 that
modify take profit with + 3pip for every 5 pip up for bay or down for sell
the problem is that modify order work once  and give me 130 error
-------""2018.04.24 23:57:30.751    2018.03.13 00:00:00  test v1.5 EURUSD,H1: OrderModify error 130"--------------
i need someone to help write this code


void modify()
  {
  int num;
  SymbolInfoTick(Symbol(),last_tick);
 
while(order == 0)
{

  if (sl == 0)
  {
  OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
  sl = OrderOpenPrice();
  type = OrderType();
  if(type == OP_BUY)
  OrderModify(OrderTicket(),OrderOpenPrice(),sl+0.0003,0,0,clrNONE);
else
OrderModify(OrderTicket(),OrderOpenPrice(),sl-0.0003,0,0,clrNONE);
}
  
  bid = last_tick.bid;
  ask = last_tick.ask;
 if(sl != 0)
  { 
  if(type == OP_BUY && sl + 0.0005 <= bid )
  
         {
           bool res;
            sl= ask + 0.0003;
         
            OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
         //if(sl + 0.0005 <= bid)
         res =OrderModify(OrderTicket(),OrderOpenPrice(),sl,0,0,clrNONE);
        
         if(!res)
         
           {
           Alert(GetLastError());
        
           }
           num ++;
       Comment("whe are in :",type," num : ",num );
            }
            else if (type == OP_SELL && sl - 0.0005 <= bid )
  
         {
           bool res;
            sl=bid-0.0003;
         
            OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
      
         res =OrderModify(OrderTicket(),OrderOpenPrice(),sl,0,0,clrNONE);
         if(!res)
         
           {
           Alert(GetLastError());
            }
              num ++;
       Comment("whe are in :",type," num : ",num );
             }
            order = OrdersTotal();
        
        }
         }
  sl=0;
 x=0;
  }
Keith Watford
Moderator
20526
Keith Watford  

Do not double post.

I have deleted your other topic.

To add comments, please log in or register