循环 mql4 的布尔函数

boolean function for loop mql4

我想写一个重申if条件

if (BOX_H1(1) && BOX_H1(2) && BOX_H1(3) && BOX_H1(4) && BOX_H1(5) && BOX_H1(6) && BOX_H1(7) && BOX_H1(8);)

在 for 循环形式中,像这样:

if (
for (int x=1;x<=7; x++)
          {
               (BOX_H1(x));

          })

其中 BOX_H1(1) 是一个采用 int(shift 参数)的布尔函数,但此代码不起作用。

有人知道我怎么写出来吗?

编辑: 我的代码是这种形式:

bool Buy_H1 =0, ...

...

if(Buy_H1) {if(...)}

...

void Entry() 
{
Buy_H1 =BOX_H1(1) && BOX_H1(2) && BOX_H1(3) && BOX_H1(4) && 
        BOX_H1(5) && BOX_H1(6) && BOX_H1(7) && BOX_H1(8) ;
}

如果我用

代替最后一个代码
void Entry() 
{
bool Buy_H1(const int parameter){
for(int i=1; i<=parameter; i++){
  if(!BOX_H1(i))
     return false; }
return true; }
}

我达到了'Buy_H1' - function can be declared only in the global scope

bool booleanFunction( const int parameter ){
     for( int i = 1; i <= parameter; i++ ){
          if ( !BOX_H1( i ) )
               return false;
     }
     return true;
}


void OnStart(){
     ...
     if (  booleanFunction( 8 ) ){
           Print( "OK" );
     }                                   //edited, your code instead of this
     ...
}