MT4 错误代码4066 ,这个错误对自定指标有影响么,怎么消去影响

 

4066

ERR_HISTORY_WILL_UPDATED

Requested history data is in updating state

 

 

4051错误是什么错误?函数的参数错误吗? 

4051

ERR_INVALID_FUNCTION_PARAMVALUE

Invalid function parameter value



 

1、请求的历史数据正在更新,意思是你的终端正在将数据从经纪商服务器侧下载下来。

此时连数据都没有,你的指标显然是无法计算的。你可以增加效验,如果当前图表的K线数量小于多少,就不运行,将指标起始计算的位置设为此位置。 

 2、参数错误,检查一下函数的参数类型等是不是有错。 

 
luenbo:

1、请求的历史数据正在更新,意思是你的终端正在将数据从经纪商服务器侧下载下来。

此时连数据都没有,你的指标显然是无法计算的。你可以增加效验,如果当前图表的K线数量小于多少,就不运行,将指标起始计算的位置设为此位置。 

 2、参数错误,检查一下函数的参数类型等是不是有错。 

1、只设置判断当前K线数量小于多少不运行, 指标起始计算位置仍然为BAR-1可以吗?

2、

double  iClose(
   string           symbol,          // symbol
   int              timeframe,       // timeframe
   int              shift            // shift
   );

Returned value

Close price value for the bar of specified symbol with timeframe and shift. If local history is empty (not loaded), function returns 0. To check errors, one has to call the GetLastError() function.

 

iclose() 如果返回0,0难道不是double类型?

Runtime Errors - MQL4 Documentation
  • docs.mql4.com
Runtime Errors - MQL4 Documentation
 

我找到4051报错的原因了。
原因: