et al,
Can someone tell me why I don't get a vaule returned for BWMin in the following indicator?
I'm trying to get the lowest value for the last 120 in the Bandwidth array.
Thanks.
Can someone tell me why I don't get a vaule returned for BWMin in the following indicator?
I'm trying to get the lowest value for the last 120 in the Bandwidth array.
Thanks.
Inserted Code
/*+------------------------------------------------------------------+ bb - %b.mq4 Copyright © 2010, Nondisclosure007 [url]http://no.link.yet[/url] [url]http://www.bollingerbands.com/services/bb/[/url] {click on Bollinger Bands Features} //+------------------------------------------------------------------+*/ #property copyright "Copyright © 2010, Nondisclosure007" #property link "[url]http://no.link.yet[/url]" #property indicator_separate_window #property indicator_buffers 2 //---- input parameters extern int bbPeriod=10; extern double bbDeviation=1.9; extern int bbPrice=PRICE_MEDIAN; double Bandwidth[],BWMin[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorShortName("Bandwidth - Period="+bbPeriod+" "); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,Blue); SetIndexBuffer(0,Bandwidth); SetIndexLabel(0,"Bandwidth"); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1,Gray); SetIndexBuffer(1,BWMin); SetIndexLabel(1,"BWMin"); IndicatorDigits(Digits+1); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //Bar stuff int counted_bars=IndicatorCounted(); int limit; if(counted_bars<0) return(-1); limit=Bars-counted_bars-1; for(int shift=0; shift<limit; shift++) { double bbUpper=iCustom(Symbol(),0,"Bands",bbPeriod,0,bbDeviation,bbPrice,1,shift); double bbMiddle=iCustom(Symbol(),0,"Bands",bbPeriod,0,bbDeviation,bbPrice,0,shift); double bbLower=iCustom(Symbol(),0,"Bands",bbPeriod,0,bbDeviation,bbPrice,2,shift); Bandwidth[shift]=(bbUpper-bbLower)/bbMiddle; BWMin[shift]=Bandwidth[ArrayMinimum(Bandwidth,120,shift+1)]; } return(0); } //+------------------------------------------------------------------+