Aplicate esta script cuando tengas ya abiertas las ordenes ...
//+------------------------------------------------------------------+
//| StopLossMove.mq4 |
//| |
//| |
//| Bookkeeper, 2006,
[email protected] |
//+------------------------------------------------------------------+
#property copyright ""
#property link ""
//+------------------------------------------------------------------+
extern int Distance=5; // Distancia del Stop Loss |
extern bool UpDoun=true; // =false |
// =true |
//+------------------------------------------------------------------+
void start()
{
double NewPrice;
int i,Total,Dist;
int Dgts=MarketInfo(Symbol(),MODE_DIGITS);
bool GoGo;
//+------------------------------------------------------------------+
// if(Distance<10>0)
{
for(i=Total-1; i>=0; i--)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)==true)
{
if(OrderSymbol()==Symbol() && OrderType()==OP_SELL)
{
NewPrice=Ask+Dist*Point;
if(UpDoun==true) GoGo=true;
else
{
if(OrderStopLoss()>NewPrice) GoGo=true;
else GoGo=false;
}
if(GoGo==true) if(OrderModify(OrderTicket(),
OrderOpenPrice(),
NormalizeDouble(NewPrice,Dgts),
OrderTakeProfit(),
OrderExpiration(),
CLR_NONE)!=TRUE)
Print("LastError = ", GetLastError());
}
if(OrderSymbol()==Symbol() && OrderType()==OP_BUY)
{
NewPrice=Bid-Dist*Point;
if(UpDoun==true) GoGo=true;
else
{
if(OrderStopLoss()<NewPrice) GoGo=true;
else GoGo=false;
}
if(GoGo==true) if(OrderModify(OrderTicket(),
OrderOpenPrice(),
NormalizeDouble(NewPrice,Dgts),
OrderTakeProfit(),
OrderExpiration(),
CLR_NONE)!=TRUE)
Print("LastError = ", GetLastError());
}
}
}
}
}
//+------------------------------------------------------------------+
Un saludo