Looping For

 

I built an indicator that shows +1 when stochastic is above +80 and shows -1 whent it's below +20.

I would like to biult one other indicator which sum +1 for each time the stochastic remains above +80 and sum -1 for each time the stochastic still below 20.

I know that I need to do a Looping, but I don't know if an array is allowed. Can you show me an exemple and how would you probably do?

I did this way, but it's not working.

SumUp[i]=0;      
    
      while(Stoch_Breakout[i]==1) /// if Stochastic >80 go ahead.   
         {
            SumUp[i]=SumUp[i]+1;
         }
      

Thanks

rodrigosm

Reason: