jiaoben 
#include <stderror.mqh>
#include <stdlib.mqh>
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
double  TakeProfit;
double StopLoss;
color clr = Blue;
void OnStart()
  {
//---
   if(Digits==5 ||Digits==3)
   {
      TakeProfit*=10;
      StopLoss*=10;
   }
   if(!IsTradeAllowed()){Alert("脚本检测到你没有允许自动交易,请先设置允许自动交易,再重新加载脚本"); 
       return;
   }
   if(OrdersTotal()==0)  
       return;
   double sl;
      
      for(int i=0;i<OrdersTotal();i++)  {
        if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){
       // if (OrderSymbol()==Symbol()) { 
       //设置止损,和开仓价格
        double stp=NormalizeDouble(OrderStopLoss(),Digits);   
        double OpenPrice = NormalizeDouble(OrderOpenPrice(),Digits); 
        if(OrderType()==OP_BUY)
             {
               if( stp == 0 && (Bid - OpenPrice) > 0 )sl = OpenPrice;else sl =OrderStopLoss();  
                  sl=NormalizeDouble(sl,Digits); clr=Blue;             
                if(!OrderModify(OrderTicket(),OrderOpenPrice(),sl,0,0,clr))
                Print("OrderModify Error: " ,ErrorDescription(GetLastError()));                                   
              }
        else if(OrderType()==OP_SELL)
             {
                if( stp == 0 && (OpenPrice-Ask) > 0 ) sl=OpenPrice;else sl=OrderStopLoss(); 
                   sl=NormalizeDouble(sl,Digits); clr=Blue;
                if(!OrderModify(OrderTicket(),OrderOpenPrice(),sl,0,0,clr))
                 Print("OrderModify Error: " ,ErrorDescription(GetLastError()));
               }
          //}
          }//if OrderSelect
        }//for    
  }
//+------------------------------------------------------------------+