Brooke, Re "Which version is the closest to the original? I think I like 0 to -55 since 0 represents the most recent day and -60 takes us back to the 13th week.", isn't it a tossup in that -55 fails to test ma10 > ma50 at -60. If you want an exact match, add a final if to yours ------- maup:=0; for i = 0 to -55 step -5 do ma50:=movavg(i,50,Cl); //use it twice if movavg(i,10,Cl)> ma50 and ma50 > movavg(i-5,50,Cl)then maup:=maup + 2; // 24 max endif; next i; if movavg(-55,50,Cl) > movavg(-60,50,Cl)then maup:=maup + 1; endif; // test for maup = 25 -------- or use my previously posted code ----------------- maup:=0; for i = 0 to -60 step -5 do ma50:=movavg(i,50,Cl); //use it twice if movavg(i,10,Cl)> ma50 then maup:=maup + 1; // 13 max endif; if ma50 > movavg(i-5,50,Cl) and i != -60 then maup:=maup + 1; // 12 max, sum = 25 endif; next i; // test for maup = 25 ------------- Haven't checked, but doubt that either would run appreciably slower.
Bob |