The indicator code I'm posting doesn't calculate on candles already in the chart. Can anyone tell me why?
Specifically the BWMin value (nor does it show up in the chart when there is a value).
ps. Thanks to hayseed helping me w/ my other problem. on this indicator found here:
Inserted Code
#property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red //---- input parameters extern int bbPeriod = 20; extern int bbDeviation = 2; extern int bbPrice = 0; extern int bbDigits = 2; int lookback = 120; double Bandwidth[],BWMin[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(4); IndicatorShortName("Bandwidth - Period="+bbPeriod+" "); SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,Bandwidth); SetIndexLabel(0,"Bandwidth"); SetIndexStyle(1,DRAW_LINE); 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, shift, shift2; double bbUpper, bbLower, bbMiddle; if(counted_bars<0) return(-1); limit=Bars-counted_bars-1; for(shift=0; shift<limit; shift++) { bbUpper=iBands(NULL,0,bbPeriod,bbDeviation,0,bbPrice,MODE_UPPER,shift); bbLower=iBands(NULL,0,bbPeriod,bbDeviation,0,bbPrice,MODE_LOWER,shift); bbMiddle=iBands(NULL,0,bbPeriod,bbDeviation,0,bbPrice,0,shift); Bandwidth[shift]=NormalizeDouble(((bbUpper-bbLower)/bbMiddle)*100,bbDigits); } for(shift2=0; shift2<limit; shift2++) { double MinBw=Bandwidth[ArrayMinimum(Bandwidth,lookback,shift2+1)]; BWMin[shift2]=(MinBw*0.25)+MinBw; } return(0); }
ps. Thanks to hayseed helping me w/ my other problem. on this indicator found here: