Check only at price close?

 
Hi all, could you check this code for me?

It is supposed to alert when RSI and stoch are above their overbought (or below oversold) levels and if the price closes above bollinger. It is only supposed to look at values at price close. As of now, I still get alerts if the values say fluctuated above 70 for rsi, or above 80 for stoch, or above the upper band but they didn't finish above, yet I still get the signal? I'm fairly new at this so some help would be greatly appreciated.

Files:
 

I haven't looked closely at your code, but if you only want to check closed bars, use index(shift) 1 not 0.

  //---------------------------------------------------------------- 
   double RSI_Price = iRSI(NULL,0,14,0,0);
   double STOC_Price = iStochastic(NULL,0,5,3,3,0,0,0,0);
   double BOLI_Price_UP = iBands(NULL,0,20,2,0,0,1,0);
   double BOLI_Price_DOWN = iBands(NULL,0,20,2,0,0,2,0);
   
  //---------------------------------------------------------------- 

 


 

 
GumRai:

I haven't looked closely at your code, but if you only want to check closed bars, use index(shift) 1 not 0.

 Oh, I didn't know that, thanks


 

Reason: