//+------------------------------------------------------------------+ //| Bandwidth Indicator.mq4 //| Copyright © 2007, Fxid10t@yahoo.com //| http://www.fxstreet.com/education/technical/identifying-budding-trends-with-bollinger-bands/2006-06-14.html //+------------------------------------------------------------------+ #property copyright "Copyright © 2007, Fxid10t@yahoo.com" #property link "http://www.fxstreet.com/education/technical/identifying-budding-trends-with-bollinger-bands/2006-06-14.html" #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Red //---- input parameters extern int chart.timeframe=0; extern int period=20; extern int deviation=2; extern int bands.shift=0; extern int applied.price=0; double BWI,ub,lb,mb; //---- indicator buffers double BWI.Buffer[]; int init() { IndicatorBuffers(1); SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0, BWI.Buffer); IndicatorShortName("BWI"); SetIndexDrawBegin(0,period); SetIndexLabel(0,"BWI"); return(0); } int deinit() {return(0);} int start() { int limit; int counted_bars=IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); //---- the last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- main loop for(int i=0; i<limit; i++) { ub=iBands(Symbol(),chart.timeframe,period,deviation,bands.shift,applied.price,1,i); lb=iBands(Symbol(),chart.timeframe,period,deviation,bands.shift,applied.price,2,i); mb=iBands(Symbol(),chart.timeframe,period,deviation,bands.shift,applied.price,0,i); Print(ub,lb,mb); BWI.Buffer[i]=((ub-lb)/mb)*100;} return(0);}
Sample
Analysis
Market Information Used:
Indicator Curves created:
Implements a curve of type DRAW_LINE
Indicators Used:
Bollinger bands indicator
Custom Indicators Used:
Order Management characteristics:
Other Features: