Craig, Believe you get "issues hitting 8 yr high CCI(21) value in the past 10 days with a closing price 33% less than 8 yr max" by the code below. Still not the speediest because has to go all the way back to confirm that CCI is max. Will leave TF+ version for another day. -Bob --- // High CCI21 w/ Price Divergence rediddled by dr j exchange = nyse, amex, nasdaq; output = "CCImax.lst"; daystoload = 2000; // 8 years. Note 3000 days (12 years) now available daysrequired =30; Integer firstday, i, CCIdate, printflag; float maxHi, maxCCI;
set CCI = 21; firstday :=((DaysLoaded-1)*-1); maxHi := max(0, firstday, cl);
maxCCI := -999; for i= 0 to -9 step -1 do if cci(i) > maxCCI then maxCCI := cci(i); // trust me CCIdate := i; endif; next i; printflag := 0; if close(CCIdate) < .66*maxHi then // 1st condition printflag := 1; for i = -10 to firstday step -1 do if cci(i) > maxCCI then // failed 2nd condition i := firstday; printflag := 0; endif; next i; endif; if printflag = 1 then Println Symbol:-5,",",maxCCI:6:2,",",maxHi:6:2,",", close(CCIDate):6:2,",",date(CCIDate); endif; |