EA: 5_8 MACross - 页 4

 
Shara1:

也就是说,我需要在这一行之后 -int OnInit()

插入以下内容

就像这样

谢谢

不完全是这样。您需要比较参数 "mafastperiod "和 "maslowperiod"。

 
Vladimir Karputov:

不完全是这样。您需要比较参数 "mafastperiod "和 "maslowperiod"。

所以我只需要添加一行?像这样

//+------------------------------------------------------------------+

//| 专家初始化函数|

//+------------------------------------------------------------------+

int OnInit()

{

if(Inpmaslowperiod>=Inpmafastperiod)

{

 

OnInit() 中,不允许出现 "fast "大于或等于 "slow "的情况:

//+------------------------------------------------------------------+
//| 专家初始化函数|
//+------------------------------------------------------------------+
int OnInit()
  {
   if(mafastperiod>=maslowperiod)
     {
      Print("\"MA fast: averaging period\" can not be greater and equal to \"MA slow: averaging period\"");
      return(INIT_PARAMETERS_INCORRECT);
     }
   SetMarginMode();
 
Vladimir Karputov:

OnInit() 中,不允许出现 "fast "大于或等于 "slow "的情况:

谢谢,代码编译成功了。


//+------------------------------------------------------------------+
//| 专家初始化函数|
//+------------------------------------------------------------------+
int OnInit()
  {
   if(mafastperiod>=maslowperiod)
     {
      Print("\"MA fast: averaging period\" can not be greater and equal to \"MA slow: averaging period\"");
      return(INIT_PARAMETERS_INCORRECT);
     }
   SetMarginMode();
   SetMarginMode();

但这两行是一样的,应该是这样吗?

 
Shara1:

谢谢,代码编译成功了。


但这两行是一样的吗?

不,你多复制了一行。去掉一行。

 
Vladimir Karputov:

不,你多抄了一行。去掉一行

非常感谢。是否可以将此功能添加到任何有两个 "muves "的 EA 中?

 
Shara1:

非常感谢。那么您可以将它添加到任何有两个缪维的 EA 中吗?

是的,最重要的是正确书写变量名。

 
Vladimir 测试人员写了一个错误。请看看我的错误是什么。
附加的文件:
20180221.log  11 kb
 
Shara1:
Vladimir 测试人员写了一个错误。请看看我的错误是什么。

一切正常。

"输入参数不正确 "只是代码在遗传优化过程中触发了

   if(mafastperiod>=maslowperiod)
     {
      Print("\"MA fast: averaging period\" can not be greater and equal to \"MA slow: averaging period\"");
      return(INIT_PARAMETERS_INCORRECT);
     }

在遗传优化过程中

 
Vladimir Karputov:

没事的

"输入参数不正确 "只是一个代码触发器。

在遗传优化过程中。

谢谢,但在优化窗口中,有些线是红色的,是因为这个原因吗?