sisuname:=’全数検索’;
Dnoloop:=off;
var i,stdno,code,varA,Dnum,SMAP,fnSMA,fnkairi,count,data[5000,6],p,a,temp;
begin
{$definit}
{$defend}
for code:=8888 to 9999 do
if (sijo(code)=0) then begin
Dnum:=readkabudata(data,'hiashi',code,true,true);
for i:=1 to Dnum do begin
statusout(code);
/--------------必要な条件を記述-----------------------------
if (calckairi(i,25) < -10)
/-----------------------------------------------------------
then begin
temp:=data[i,0]+' '+count+' '+code+' '+meigaraname(code)+' '+data[i,4]+' '+calckairi(i,25);
appendtext(temp,'c:\fchart\data\test.txt');
count:=count+1;
debugout(data[i,0],' ',count,' ',code,' ',meigaraname(code),' ',data[i,4],' ',calckairi(i,25))
end;
end;
end;
if count=0 then message('検出銘柄はありません')
else message(count+'銘柄が検出されました');
end;
function CalcSMA(d,Dnum);
var a,i;
begin
a:=0;
if Dnum<=0 then exit;
if (d-Dnum)>0 then begin
for i:=d-Dnum+1 to d do
a:=a+data[i,4];
end;
result:=a/Dnum;
end;
function Calckairi(d,Dnum);
var a,b,i;
begin
a:=0;
if Dnum<=0 then exit;
if (d-Dnum)>0 then begin
for i:=d-Dnum+1 to d do begin
b:=calcSMA(i,25);
a:=data[i,4];
end;
end;
result:=((a-b)/b) *100;
end;