Hi, I'm learning simple coding now and hopefully you can guide me. I intend to create a non-global loop to detect the "shift" of open price of lower tf that equal to the open price of higher tf, in this case, tf=M5 and tf=30.

int cOpShf=0;

{

int OpBigTf=30, OpSmlTf=5;

for(int i=0; i<OpBigTf/OpSmlTf; i++)

{

double cOpBigTf=iOpen(NULL,OpBigTf,0);

double cOpSmlTf=iOpen(NULL,OpSmlTf,i);

if(cOpBigTf != cOpSmlTf) i++;

cOpShf=i;

}

}

I cannot get it right (I want to get the shift number of cOpShf), could you please help ? Thanks

int cOpShf=0;

{

int OpBigTf=30, OpSmlTf=5;

for(int i=0; i<OpBigTf/OpSmlTf; i++)

{

double cOpBigTf=iOpen(NULL,OpBigTf,0);

double cOpSmlTf=iOpen(NULL,OpSmlTf,i);

if(cOpBigTf != cOpSmlTf) i++;

cOpShf=i;

}

}

I cannot get it right (I want to get the shift number of cOpShf), could you please help ? Thanks