can somebody fix this code so that the values of the temp array is added to the combine array for a specified period given...I just can't get it to work
PHP Code
// See http://www.forexrealm.com/technical-analysis/technical-indicators/price-action-indicator.html #property indicator_buffers 1 #property indicator_separate_window #property indicator_color1 Lime double combine[]; double temp[]; extern int MoveAvgPeriod = 3; int init() { string short_name; SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,combine); SetIndexBuffer(1,temp); short_name="Combine("+MoveAvgPeriod+")"; IndicatorShortName(short_name); SetIndexLabel(0,short_name); SetIndexDrawBegin(0,combine); return(0); } int start() { int i, counted_bars=IndicatorCounted(); if(Bars<=MoveAvgPeriod) return(0); if(counted_bars<1) for(i=1;i<=MoveAvgPeriod;i++) temp[Bars-i]=0.0; i=Bars-counted_bars-1; double sum=0; while(i>=0) { double close = Close[i]; double open= Open[i]; double high=High[i]; double low=Low[i]; temp[i]=((close-open)+(close-high)+(close-low))/Point; i--; } if(counted_bars>0) counted_bars--; int limit=Bars-counted_bars; for(i=0; i<limit; i++) combine[i]=sum+temp[i]; //----------------- return(0); }