520的牛版,我国外网站搞了个EA,分享到论坛,测试用不了... 是不是MT4升级的原因,望纠正,造福需要的人 ~~~ 
 //+------------------------------------------------------------------+ 
//|                                                   TakeProfit.mq4 | 
//|  Modded slightly by verbtheory for verbtheory's day break system | 
//|                               Copyright ?2006, Taylor Stockwell | 
//|                                               stockwet@yahoo.com | 
//|                                                    Version: 2.4  | 
//+------------------------------------------------------------------+ 
#property copyright "Copyright ?2006, Taylor Stockwell" 
#property link      "stockwet@yahoo.com" 
/* 
Updates: 
   11/2/2006:: Fixed bug that caused the sl var to be set to 1 when a pending 
               order was > than the First_Stop_Target value. 
   1/23/2007:: Fixed pip calculation. The old way of calculating pips could be 
               off by 1 pip, resulting in missed TP or move stops. The new 
               calculation is more accurate. 
   4/07/2009:: Adding trailing stop, enhancing shortly. 
*/ 
//=============== VARS external 
extern int First_Target = 50; 
extern int Target_Increment = 25; 
extern double Close_Lots = 0; 
extern bool Move_Stops = true; 
extern int First_Stop_Target = 80; 
extern int First_Stop = 20; 
extern int Second_Stop_Target = 350; 
extern int Second_Stop = 200; 
extern int Third_Stop_Target = 650; 
extern int Third_Stop = 500; 
extern int Fourth_Stop_Target = 2000; 
extern int Fourth_Stop = 1500; 
extern int Fifth_Stop_Target = 4000; 
extern int Fifth_Stop = 3000; 
extern bool Use_Max_Loss = true; 
extern int Max_Loss = 350; 
extern int Magic_Number=0; 
//=============== VARS internal 
int nextTP; 
bool sl; 
int range = 5; 
int multiplier; 
// OrderType == 1 is OP_SELL 
//=============== FUNCTION init 
int init() 
  { 
   sl=0; 
   nextTP = First_Target; 
   getMaxLoss(); 
  } 
//== end function 
//=============== FUNCTION deinit 
int deinit() 
  { 
//---- 
   sl=0; 
   nextTP = First_Target; 
//---- 
   return(0); 
  } 
//== end function 
//========== FUNCTION Start 
int start() 
  { 
//---- 
   getOpenOrders(); 
   getSpread(); 
   //Comment(sl); 
//---- 
   return(0); 
  } 
//== end function 
//========== FUNCTION getPipValue 
double getPipValue(double ord,int dir) 
{ 
   double val; 
   RefreshRates(); 
   if(dir == 1) val=(NormalizeDouble(ord,Digits) - NormalizeDouble(Ask,Digits)); 
   else val=(NormalizeDouble(Bid,Digits) - NormalizeDouble(ord,Digits)); 
   val = val/Point; 
   return(val);    
} 
//== end function 
int getSpread() 
{ 
   int spread=MarketInfo(Symbol(),MODE_SPREAD); 
   return(spread); 
} 
int getMaxLoss() 
{ 
   int calcMaxLoss; 
   calcMaxLoss = Max_Loss; 
   return(calcMaxLoss); 
} 
//========== FUNCTION getOpenOrders 
void getOpenOrders() 
{ 
   int nsl, nsd; 
   string mngMagic; 
   int totalorders = OrdersTotal(); 
   for(int j=0; j 0) killTrade(val,OrderTicket()); 
            if(Move_Stops) checkStops(val,OrderTicket()); 
            takeProfit(val,OrderTicket());             
         } 
         if(Magic_Number == 0) 
         mngMagic = "All "+Symbol()+" trades."; 
         else 
         mngMagic = "Trades with magic number = "+Magic_Number; 
         if(sl==0) 
            { 
               nsl = First_Stop_Target; 
               nsd = First_Stop; 
            } 
          else 
            { 
               nsl = Second_Stop_Target; 
               nsd = Second_Stop; 
            } 
          else 
            { 
               nsl = Third_Stop_Target; 
               nsd = Third_Stop; 
            } 
          else 
            { 
               nsl = Fourth_Stop_Target; 
               nsd = Fourth_Stop; 
            } 
          else 
            { 
               nsl = Fifth_Stop_Target; 
               nsd = Fifth_Stop; 
            } 
         //RefreshRates(); 
         Comment("Order Open: ",OrderOpenPrice(),  
         "\nPip Count: ", val, 
         "\nNext Stop Target: ",nsl, 
         "\nNext Stop Differential: ", nsd, 
         "\nNext TP: ", nextTP, 
         "\nSL: ",sl, 
         "\nMax Loss: ", getMaxLoss(), 
         "\nManaging: ",mngMagic); 
     }   
} 
//========== FUNCTION takeProfit 
void takeProfit(int pips, int ticket) 
{ 
   if(OrderSelect(ticket, SELECT_BY_TICKET)==true) 
   { 
      if(pips >= nextTP && pips = First_Stop_Target && pips = Second_Stop_Target) 
   { 
      if(pips >= Second_Stop_Target) 
      { 
         moveStops(ticket,Second_Stop); 
      } 
   } 
   else if(sl==2 || pips >= Third_Stop_Target) 
   { 
      if(pips >= Third_Stop_Target) 
      { 
         moveStops(ticket,Third_Stop); 
      } 
   } 
   else if(sl==3 || pips >= Fourth_Stop_Target) 
   { 
      if(pips >= Fourth_Stop_Target) 
      { 
         moveStops(ticket,Fourth_Stop); 
      } 
   } 
   else if(sl==4 || pips >= Fifth_Stop_Target) 
   { 
      if(pips >= Fifth_Stop_Target) 
      { 
         moveStops(ticket,Fifth_Stop); 
      } 
   } 
} 
//== end function 
//========== FUNCTION moveStops 
void moveStops(int ticket,int stopDiff) 
{ 
   if(OrderSelect(ticket, SELECT_BY_TICKET)==true) 
   { 
      Print("moveStops called ",ticket, " ",stopDiff); 
      if(OrderType()==1)  
      { 
      OrderModify(ticket,OrderOpenPrice(),OrderOpenPrice()-stopDiff*Point, OrderTakeProfit(),0,Plum); 
      sl=1; 
      } 
      else  
      { 
      OrderModify(ticket,OrderOpenPrice(),OrderOpenPrice()+stopDiff*Point, OrderTakeProfit(),0,Plum); 
      sl=1; 
      } 
   } 
} 
//== end function 
//========== FUNCTION killTrades 
void killTrade(int pips, int ticket) 
{ 
   if(OrderSelect(ticket, SELECT_BY_TICKET)==true) 
   { 
      if(pips <= -1*getMaxLoss()) 
      { 
         if(OrderType()==1) OrderClose(ticket,OrderLots(),Ask,3,Red);      
         else OrderClose(ticket,OrderLots(),Bid,3,Red);  
      }       
   } 
} 
//== end function 
 |