//+------------------------------------------------------------------+
//| modify all target.mq4 |
//| Copyright © 2010, Aiman |
//| Aiman |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, Aiman"
#property link "Aiman CG"
#property show_inputs
extern int TP = 0;
extern int SL = 0;
int start()
{
//----
double TPBuy,TPSell,SLBuy,SLSell;
if(TP>0)
{
TPBuy=Bid+TP*Point;
TPSell=Ask-TP*Point;
}
if (SL>0)
{
SLBuy=Ask-SL*Point;
SLSell=Bid+SL*Point;
}
for(int i=0;i<OrdersTotal();i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol()!=Symbol()) continue;
if (OrderType()==OP_BUY || OrderType()==OP_BUYLIMIT) OrderModify(OrderTicket(), OrderOpenPrice(), SLBuy, TPBuy, 0, CLR_NONE);
if (OrderType()==OP_SELL || OrderType()==OP_SELLLIMIT) OrderModify(OrderTicket(), OrderOpenPrice(), SLSell, TPSell, 0, CLR_NONE);
Sleep(1000);
}
//----
return(0);
}