Bollinger Bands - Help Please!

 

Here is the formula for the BB. Can someone please help me calculate where the max extension would be if price was trying to cross the BB? 
I am trying to draw a line at that point when the candle opens. I have attached an example as well.




 

The calculation is in the standard BB indicator.

//--- main cycle
   for(i=pos; i<rates_total && !IsStopped(); i++)
     {
      //--- middle line
      ExtMovingBuffer[i]=SimpleMA(i,InpBandsPeriod,close);
      //--- calculate and write down StdDev
      ExtStdDevBuffer[i]=StdDev_Func(i,close,ExtMovingBuffer,InpBandsPeriod);
      //--- upper line
      ExtUpperBuffer[i]=ExtMovingBuffer[i]+InpBandsDeviations*ExtStdDevBuffer[i];
      //--- lower line
      ExtLowerBuffer[i]=ExtMovingBuffer[i]-InpBandsDeviations*ExtStdDevBuffer[i];
      //---
     }

StdDev():

//+------------------------------------------------------------------+
//| Calculate Standard Deviation                                     |
//+------------------------------------------------------------------+
double StdDev_Func(int position,const double &price[],const double &MAprice[],int period)
  {
//--- variables
   double StdDev_dTmp=0.0;
//--- check for position
   if(position>=period)
     {
      //--- calcualte StdDev
      for(int i=0; i<period; i++)
         StdDev_dTmp+=MathPow(price[position-i]-MAprice[position],2);
      StdDev_dTmp=MathSqrt(StdDev_dTmp/period);
     }
//--- return calculated value
   return(StdDev_dTmp);
  }
//+------------------------------------------------------------------+

So you can use it as is or modify to meet your target application.

 
Marco vd Heijden:

The calculation is in the standard BB indicator.

StdDev():

So you can use it as is or modify to meet your target application.

I will try it for sure!!!

 
Corey Grant 2020.05.16 12:53 Can someone please help me calculate where the max extension would be if price was trying to cross the BB?
Question makes no sense. As price goes outside BB, standard deviation and MA both increase to a lesser amount. The maximum extension of the BB is infinite.
 
William Roeder:
Question makes no sense. As price goes outside BB, standard deviation and MA both increase to a lesser amount. The maximum extension of the BB is infinite.

It makes sense if you read it correctly. It is the price at which the current price and BB deviations meet. actually the extension isn't infinite if it stops after being crossed.
If you don't understand what i am saying, then please ask questions.

Reason: