need help with iBandsOnArray()

Back to topics list To post a new topic, please log in or register
avatar
59
investguy 2015.06.25 04:01
 

Hello,

 

Thank you in advance for looking this up.

Im looking to get the the StdDev cross of the upper bollinger band on my ea like the picture bellow:

 

 

  

 So far i wrote this code but i cant get the upper bollinger band(always return 0) value to compare the variables... Could anyone point me in the right direction?? Thank You 

 

extern int StdDevPeriod = 14;
extern int StdDevBolPeriod = 21;
extern double StdDevBolDeviation = 1.5;

double StdDevBuffer[],BandsStdDevBuffer[];

int init()
{  
   int StdDevCount = MathMax(StdDevPeriod,StdDevBolPeriod);
   ArrayResize(StdDevBuffer,StdDevCount*2);
   ArraySetAsSeries(StdDevBuffer,true);   
   ArrayResize(BandsStdDevBuffer,StdDevCount*2);
   ArraySetAsSeries(BandsStdDevBuffer,true);   
}

int StdDevSignal()
  {

   int StdDevCount = MathMax(StdDevPeriod,StdDevBolPeriod);   

   for(i=0; i<StdDevCount*2; i++)
     {
      StdDevBuffer[i]=iStdDev(NULL,0,StdDevPeriod,0,MODE_LWMA,PRICE_MEDIAN,i);
     }

   for(i=0; i<StdDevCount*2; i++)
     {
      BandsStdDevBuffer[i]=iBandsOnArray(StdDevBuffer,0,StdDevBolPeriod,StdDevBolDeviation,0,MODE_UPPER,i);             
      Print("StdDevBuffer for ",i," = " , StdDevBuffer[i]);
      Print("BandsStdDevBuffer for ",i," = " , BandsStdDevBuffer[i]);
     }

   Print("StdDevBuffer[0]  = ",StdDevBuffer[0] , "|| BandsStdDevBuffer[0] = " , BandsStdDevBuffer[0]);
   
   if(StdDevBuffer[0] > BandsStdDevBuffer[0]) return(1);
   else return(0);
  }
 

 

 I also have this results from the terminal when running the code... 

 

2015.06.24 17:18:13.959 2013.11.20 18:24  SESSIONS EURUSD,M30: StdDevBuffer for 3 = 0.0005

2015.06.24 17:18:13.959 2013.11.20 18:24  SESSIONS EURUSD,M30: BandsStdDevBuffer for 2 = 0

2015.06.24 17:18:13.959 2013.11.20 18:24  SESSIONS EURUSD,M30: StdDevBuffer for 2 = 0.0004

2015.06.24 17:18:13.959 2013.11.20 18:24  SESSIONS EURUSD,M30: BandsStdDevBuffer for 1 = 0

2015.06.24 17:18:13.959 2013.11.20 18:24  SESSIONS EURUSD,M30: StdDevBuffer for 1 = 0.0004

2015.06.24 17:18:13.959 2013.11.20 18:24  SESSIONS EURUSD,M30: BandsStdDevBuffer for 0 = 0

2015.06.24 17:18:13.959 2013.11.20 18:24  SESSIONS EURUSD,M30: StdDevBuffer for 0 = 0.0007


Back to topics list  

To add comments, please log in or register