切换时间周期EA会重新加载,导致对象被删除,需要重新创建对象,这个如何解决,谢谢!

要添加评论,请登录注册
Bi Lao
168
Bi Lao  


代码如下:

int deinit()

{  
   ObjectsDeleteAll();   
   return (0);

}

切换时间周期就会执行deinit的

Jinsong Zhang
14875
Jinsong Zhang  
取图表货币对,若货币对相同则略过代码
enbo lu
版主
1971
enbo lu  
   switch(UninitializeReason())
   {
      case REASON_CHARTCLOSE:
      {

         Print("Chart closed.");break;
      }      
      case REASON_REMOVE:    
      {
         
         Print("Indicator removed from chart.");break;
      } 
      case REASON_RECOMPILE:
      {
         Print("Indicator recompiled.");break;
      }
         
      case REASON_CHARTCHANGE:
      {
         
         Print("symbol or timeframe changed on the chart.");break;
      }
      case REASON_PARAMETERS:
      { 
         
         Print("Inputs parameters was changed by user.");break; 
      }
      case REASON_ACCOUNT:
      {  
         Print("Other account activated.");break;  
      }
      case REASON_CLOSE:
      { 
           Print("Terminal has been closed.");break;
      }
   } 

那种情况要删除对象就在哪个case里写。

要添加评论,请登录注册