下载MetaTrader 5
要添加评论,请登录注册
加快MQL5 Cloud Network的速度。安装策略测试代理!
包连陈
8
包连陈 2008.09.18 10:10 
你的智能交易发现错误:
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到底是怎么回事,是不是检测的问题?因为在模拟服务器上运行都没有问题的???

请高手指点!

Xiaohuan Zhang
17
Xiaohuan Zhang 2008.09.18 16:36  
这类错误,是因为Ordermodify()中,止损止盈点的设置有问题,过小所致
Jinsong Zhang
14620
Jinsong Zhang 2008.09.19 09:42  

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

PengSheng_Lin
34
PengSheng_Lin 2008.09.20 15:34  
song_song >>

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

最小的止损范围是多少?

yi zhang
9
yi zhang 2011.10.07 04:08  

下面的例子能够解决:

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

//+------------------------------------------------------------------+
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)

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

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

/
要添加评论,请登录注册