回复 38楼 sdta
这次全部正确,,谢了
CLOSE TABLES USE 1a0001.DBF ALIAS A T1=seconds() BLANK ALL FIELDS K,D,TRIX,TRMA G=0 FOR I=1 TO RECCOUNT()-8 SELECT SHHIGH,SHLOW FROM 1A0001 WHERE BETWEEN(RECNO(),I,I+8) INTO ARRAY AA =ACOPY(AA,BB) =ASORT(BB,1) &&按SHHIGH排序 BB1=BB(9,1) &&最大值 =ASORT(BB,2) &&按SHLOW排序 BB2=BB(1,2) &&最小值 SELECT A REPLACE K WITH BB2,D WITH BB1,TRIX WITH (ABS(shclose-k)/ABS(d-k))*100,TRMA WITH (TRIX+2*G)/3 FOR RECNO()=I+8 G=TRMA ENDFOR MESSAGEBOX("共用时间: "+TRANSFORM(seconds()-T1,"@Z 999.99")+" 秒") BROWSE结果可对,你下一步的代码段放在楼下。楼上的代码段和前面的不一样,怎么回事。
CLOSE TABLES USE 1a0001.DBF ALIAS A T1=seconds() BLANK ALL FIELDS K,D,TRIX,TRMA G=0 nday=9 &&修改天数 FOR I=1 TO RECCOUNT()-(nday-1) SELECT SHHIGH,SHLOW FROM 1A0001 WHERE BETWEEN(RECNO(),I,I+(nday-1)) INTO ARRAY AA =ACOPY(AA,BB) =ASORT(BB,1) &&按SHHIGH排序 BB1=BB(nday,1) &&最大值 =ASORT(BB,2) &&按SHLOW排序 BB2=BB(1,2) &&最小值 SELECT A REPLACE K WITH BB2,D WITH BB1,TRIX WITH (ABS(shclose-k)/ABS(d-k))*100,TRMA WITH (TRIX+2*G)/3 FOR RECNO()=I+(nday-1) G=TRMA ENDFOR MESSAGEBOX("共用时间: "+TRANSFORM(seconds()-T1,"@Z 999.99")+" 秒") BROWSE