请求帮助,举办方检测EA发现OrderModify error 1,到底如何解决???

 
你的智能交易发现错误:
2008.09.18 03:10 loading
blcma2008 on USDJPY:15
03:10:16 2008.01.16 16:43  blcma2008 USDJPY,M15: OrderModify error 1
03:10:16 2008.01.16 16:43  blcma2008 USDJPY,M15: OrderModify error 1
03:10:16 2008.01.16 16:43  blcma2008 USDJPY,M15: OrderModify error 1
03:10:16 2008.01.17 14:48  blcma2008 USDJPY,M15: OrderModify error 1
03:10:16 2008.01.17 14:48  blcma2008 USDJPY,M15: OrderModify error 1
03:10:16 2008.01.17 14:48  blcma2008 USDJPY,M15: OrderModify error 1
03:10:16 2008.01.17 14:48  blcma2008 USDJPY,M15: OrderModify error 1
03:10:16 2008.01.17 14:48  blcma2008 USDJPY,M15: OrderModify error 1
03:10:16 2008.01.17 14:48  blcma2008 USDJPY,M15: OrderModify error 1
03:10:16 2008.01.17 15:05  blcma2008 USDJPY,M15: OrderModify error 1
03:10:16 2008.01.17 15:05  blcma2008 USDJPY,M15: OrderModify error 1
03:10:16 2008.01.17 15:05  blcma2008 USDJPY,M15: OrderModify error 1
03:10:16 2008.01.17 15:05  blcma2008 USDJPY,M15: OrderModify error 1
03:10:16 2008.01.17 15:05  blcma2008 USDJPY,M15: OrderModify error 1
03:10:16 2008.01.17 15:05  blcma2008 USDJPY,M15: OrderModify error 1
03:10:16 2008.01.23 04:13  blcma2008 USDJPY,M15: OrderModify error 1
03:10:16 2008.01.23 04:13  blcma2008 USDJPY,M15: OrderModify error 1
03:10:16 2008.01.23 04:13  blcma2008 USDJPY,M15: OrderModify error 1
03:10:16 2008.01.23 04:13  blcma2008 USDJPY,M15: OrderModify error 1
03:10:16 2008.01.23 04:13  blcma2008 USDJPY,M15: OrderModify error 1
257 kb of log files
0 min 20 seconds
Errors: 20

这个ordermodify error 1到底是怎么回事,是不是检测的问题?因为在模拟服务器上运行都没有问题的???

请高手指点!

 
这类错误,是因为Ordermodify()中,止损止盈点的设置有问题,过小所致
 

将止损止盈加大1个Point就可以了

 
song_song >>

将止损止盈加大1个Point就可以了

最小的止损范围是多少?

 

下面的例子能够解决:

原来的代码段如下——————

//+------------------------------------------------------------------+
int _MoveStopCZ(int MAGIC, double BASE,int ORDERTYPE)//_MoveStop(MAGIC, MOVE);
  {
//----
   double BaseTemp=NormalizeDouble(BASE,Digits);
   for ( int z = OrdersTotal() - 1; z >= 0; z -- )
   {
     if ( !OrderSelect( z, SELECT_BY_POS ) )
     {
       Print("OrderSelect(", z, ",SELECT_BY_POS) - Error #",GetLastError() );
       continue;
     }
     if (OrderSymbol()!=Symbol())continue;
     if (OrderMagicNumber() != MAGIC )continue;
     if (OrderType()==ORDERTYPE)
     {
       if (ORDERTYPE==OP_BUY && OrderStopLoss()<BaseTemp-1*Point)
       if(!OrderModify(OrderTicket(),OrderOpenPrice(),BaseTemp,OrderTakeProfit(),OrderExpiration()))
       {
         return(-1);
       }
       if (ORDERTYPE==OP_SELL && OrderStopLoss()>BaseTemp+1*Point)
       if(!OrderModify(OrderTicket(),OrderOpenPrice(),BaseTemp,OrderTakeProfit(),OrderExpiration()))
       {
         return(-1);
       }
     }
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+

修改之后的代码段:——

//+------------------------------------------------------------------+
int _MoveStopCZ(int MAGIC, double BASE,int ORDERTYPE)//_MoveStop(MAGIC, MOVE);
  {
//----
   double BaseTemp=NormalizeDouble(BASE,Digits);
   for ( int z = OrdersTotal() - 1; z >= 0; z -- )
   {
     if ( !OrderSelect( z, SELECT_BY_POS ) )
     {
       Print("OrderSelect(", z, ",SELECT_BY_POS) - Error #",GetLastError() );
       continue;
     }
     if (OrderSymbol()!=Symbol())continue;
     if (OrderMagicNumber() != MAGIC )continue;
     if (OrderType()==ORDERTYPE)
     {
       if (ORDERTYPE==OP_BUY && NormalizeDouble(OrderStopLoss(),Digits)!=NormalizeDouble(BaseTemp,Digits))
       if(!OrderModify(OrderTicket(),OrderOpenPrice(),BaseTemp,OrderTakeProfit(),OrderExpiration()))
       {
         return(-1);
       }
       if (ORDERTYPE==OP_SELL && NormalizeDouble(OrderStopLoss(),Digits)!=NormalizeDouble(BaseTemp,Digits))
       if(!OrderModify(OrderTicket(),OrderOpenPrice(),BaseTemp,OrderTakeProfit(),OrderExpiration()))
       {
         return(-1);
       }
     }
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+

代码中加入了修改订单止损的条件:

NormalizeDouble(OrderStopLoss(),Digits)!=NormalizeDouble(BaseTemp,Digits)

意义在于:如果当前的止损价没有被修改时,那么就进行修改。

否则如果当前的止损价已经被修改了,那么就不往下执行(就不进行修改了)