Navigation´╝ÜHome > Content >

Bolling_Band_Width.mq4

Time: 2010-06-02 | Download file:Bolling_Band_Width.mq4

//+------------------------------------------------------------------+
//|                                          _BollingerBandWidth.mq4 |
//|                                                    www.TFmt4.com |
//|                                             http://www.TFmt4.com |
//+------------------------------------------------------------------+
// Our indicator started with codebase found here: http://codebase.mql4.com/5684

#property copyright "Visit www.TFmt4.com"
#property link      "http://www.TFmt4.com"

//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 2
#property  indicator_color1  Yellow
#property  indicator_color2  Red


//---- indicator parameters
extern int BBSlowPeriods=20;
extern double BBSlowDev=2.0;

extern int BBFastPeriods=5;
extern double BBFastDev=2;
//---- indicator buffers
double     bbwidth[];
double     bbwidth_1[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1, DRAW_LINE);

   
//---- indicator buffers mapping
   SetIndexBuffer(0,bbwidth);
   SetIndexBuffer(1,bbwidth_1);

   
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("Bollinger BandWidth(S:"+BBSlowPeriods+", F:"+BBFastPeriods+")");
   SetIndexLabel(0,"("+BBSlowPeriods+") BandWidth");
   
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Create the BandWidth line                                        |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;

//---- calculate values
   for(int i=0; i        

Recommend