Better Bollinger Bands... - page 31

 
drbastem:

How do. Please write.,

Uppers Bands=20,2 Bollingers Band+2 Levels 

Lowers  Bands=20,2 Bollingers Band-2 Levels  

UpperBand[shift]=iMA(NULL,0,20,0,MODE_SMA,PRICE_CLOSE,shift)+2.0*iStdDev(NULL,0,20,0,MODE_SMA,PRICE_CLOSE,shift);
LowerBand[shift]=iMA(NULL,0,20,0,MODE_SMA,PRICE_CLOSE,shift)-2.0*iStdDev(NULL,0,20,0,MODE_SMA,PRICE_CLOSE,shift);
 
mladen:
UpperBand[shift]=iMA(NULL,0,20,0,MODE_SMA,PRICE_CLOSE,shift)+2.0*iStdDev(NULL,0,20,0,MODE_SMA,PRICE_CLOSE,shift);
LowerBand[shift]=iMA(NULL,0,20,0,MODE_SMA,PRICE_CLOSE,shift)-2.0*iStdDev(NULL,0,20,0,MODE_SMA,PRICE_CLOSE,shift);
Thank You mladen. But different Value. example normal UppewrBand (EURusd m5) value is 1.0711 and +2 levels is 1.0751. your code is Uppers band is zero.
Files:
BBAND.JPG  68 kb
 
drbastem:
Thank You mladen. But different Value. example normal UppewrBand (EURusd m5) value is 1.0711 and +2 levels is 1.0751. your code is Uppers band is zero.

It is not. Try it out and check your code before stating such thing since the code works as it should

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1  clrDodgerBlue
#property indicator_color2  clrSandyBrown
#property strict

double UpperBand[],LowerBand[];

int init()
{
   SetIndexBuffer(0,UpperBand);
   SetIndexBuffer(1,LowerBand);
   return(0);
}
int start()
{
   int counted_bars = IndicatorCounted();
      if(counted_bars<0) return(-1);
      if(counted_bars>0) counted_bars--;
         int limit = MathMin(Bars-counted_bars,Bars-1);

   //
   //
   //
   //
   //
  
   for(int shift=limit; shift>=0; shift--)
   {
      UpperBand[shift]=iMA(NULL,0,20,0,MODE_SMA,PRICE_CLOSE,shift)+2.0*iStdDev(NULL,0,20,0,MODE_SMA,PRICE_CLOSE,shift);
      LowerBand[shift]=iMA(NULL,0,20,0,MODE_SMA,PRICE_CLOSE,shift)-2.0*iStdDev(NULL,0,20,0,MODE_SMA,PRICE_CLOSE,shift);
   }      
   return(0);
}

 
drbastem:
Thank You mladen. But different Value. example normal UppewrBand (EURusd m5) value is 1.0711 and +2 levels is 1.0751. your code is Uppers band is zero.
What you are posting there is comparing apples with pears : you are showing levels, not Bollinger bands. Please decide what exactly do you want to see on the chart
 
mladen:
What you are posting there is comparing apples with pears : you are showing levels, not Bollinger bands. Please decide what exactly do you want to see on the chart

this is a bollinger band. i not want Bollinger Bands. this problem solved.  

MA2=20,MA2Mode=2; 

 Fark=((iBands(NULL,0,MA2,MA2Mode,0,PRICE_CLOSE,MODE_UPPER,i)-iBands(NULL,0,MA2,MA2Mode,0,PRICE_CLOSE,MODE_MAIN,i)))/Point;

       UstBand=iBands(NULL,0,MA2,MA2Mode,0,PRICE_CLOSE,MODE_UPPER,i)+Fark*Point;

       Fark=((iBands(NULL,0,MA2,MA2Mode,0,PRICE_CLOSE,MODE_MAIN,i)-iBands(NULL,0,MA2,MA2Mode,0,PRICE_CLOSE,MODE_LOWER,i)))/Point;

       AltBand=iBands(NULL,0,MA2,MA2Mode,0,PRICE_CLOSE,MODE_LOWER,i)-Fark*Point;

 

Thank You 

 

Hi mladen,


two question:

1: is it possible to add shift to this indicator: better_bollinger_bands_mtfalertsma_nrp-2_nmc.mq4? 

2: the alerts keep coming on even when everything is set to false. Is it possible to fix that please?


Thank you!!!

 
ok, got the shift. Alerts situation is still the same.
 

can any one help me please with this indicator just make the arrow appear on the same candle that breaks top or low bollinger , not on the next candle .

Files:
 
allright:

can any one help me please with this indicator just make the arrow appear on the same candle that breaks top or low bollinger , not on the next candle .


The signal now comes as soon as the candle breaks the BB during the current candle. You have to wait to the end of the candle to make sure the signal is still valid. This will give you a bit of time to prepare. Keep in mind that the candle can retract again and the signal will then disappear.

Files:
BB Break 2n.mq4  10 kb
 
re the better bollinger indi above, situation resolved.
Reason: