Indicators: Bollinger Bandwidth 1.0 for MT5

 

Bollinger Bandwidth 1.0 for MT5:

The indicator measures the distance between the Bollinger Bands and providing it as a singular indicator, using the MetaTrader 5 techniques to simplify Bollinger calculations.

This new version designed with MetaTrader 5 takes the calculations of iBands and calls them to perform the calculations needed to get the difference between upper and lower bandwidths.

This version also comes with an attempt to provide a digits offset so that you can drop it on a 2 digit, 3 digit, 4, digit, or 5 digit and the resulting value should be correct.

Bollinger Bandwidth for MetaTrader 5

Author: Larry

 
Automated-Trading писал(а)  :

Bollinger Bandwidth 1.0 for MT5:

Author: Larry

distance between BBs = 2 * RMS...
 

Finally, after few years trading with BollingerBand... Now I found this simple and usefull indicator to calculate Upper-Lower BB Range.....

Works great in major pair but still have bug when attach to JPY (EURJPY & USDJPY) in 4 digit broker,,,,, the width value is wrong.

I hope there will be v2.0 , to correct this issue.

Files:
JPY_Value.jpg  38 kb
 

Hi Larry, thanks for the indicator. I'd recommend to not copy all the data all the time, as this leads to massive performance drawback.

Here is a revisited copy of your OnCalculate() method:


  {
//--- variables
   double upper_band[];
   double lower_band[];

// --- Turn the arrays into dynamic series arrays 
// ArraySetAsSeries(lower_band,true);
// ArraySetAsSeries(upper_band,true);
// ArraySetAsSeries(BBandwidthBuffer,true);

//--- check if all data calculated
   if(BarsCalculated(BBHandle)<rates_total) return(0);
//--- we can copy all data
   
   int barstocopy = 0;
   if(prev_calculated>rates_total||prev_calculated<=0) {
      barstocopy = rates_total;
   } else {
      barstocopy = rates_total-prev_calculated;
      if(prev_calculated>0) barstocopy++;
   }

   if(IsStopped()) return(0);
   
   if(CopyBuffer(BBHandle,1,0,barstocopy,upper_band) <=0) return(0);
   if(CopyBuffer(BBHandle,2,0,barstocopy,lower_band) <=0) return(0);

   for(int i=0;i<barstocopy-1;i++)
     {
         BBandwidthBuffer[i]=upper_band[i]-lower_band[i];
     }

//--- return value of prev_calculated for next call
   return(rates_total);
  }
 
Hi i made a version with this formula:  bandwidth = (( upper band - lower band ) / middle band ) * 100
Files:
This website uses cookies. Learn more about our Cookies Policy.