Count bar above mid point of 5 days

 

Hi Everyone,

I am trying to count the number of bar (within the 5 bars) that are above the mid point.

This code does not work for me and I cannot find where it goes wrong.

Could you please help me with that?

Thank you so much.

HHCFX

   for (i=1; i<=limit; i++) 
   {  
      double mid=(Open[i]+Open[i+4])/2;
      
      count=0;

      for(k=i;k<=i+4;k++);
      {
         if(Close[k]>mid) t=1;else t=0;
         count=count+t;
      }

      numberbar[i]=count;
 
hhchenfx:

Hi Everyone,

I am trying to count the number of bar (within the 5 bars) that are above the mid point.

This code does not work for me and I cannot find where it goes wrong.

Could you please help me with that?

Thank you so much.

HHCFX

What "doesn't work" means in this case ?
Reason: