可以,自己画,有点烦。我作过的一个,但是只是用美国线,不是用K线。
datarec=record
openp,highp,lowp,closep:integer;
date:string;
openinterest,volum:integer;
end;
dataarray=array of datarec;//数据记录动态数组
datafile=text;
var
Form1: TForm1;
data:dataarray;
dataf:datafile;
hvolum:integer;
wmf,wmfvolum:tmetafile;
wmfcanvas,wmfvolumcanvas:tmetafilecanvas;
i: integer;
hightest,lowest:integer;
。。。。
procedure TForm1.FormCreate(Sender: TObject);
var
j,intdate,l:integer;
begin
hightest:=0;
lowest:=9999;
hvolum:=0;
if opendialog1.execute then
begin
assignfile(dataf,opendialog1.FileName);
reset(dataf);
l:=150;
setlength(data,l);
try
while not eof(dataf) do
begin
readln(dataf,intdate,data.openp,data.highp,data.lowp,
data.closep,data.volum);
data.date:=inttostr(intdate);
if data.highp>hightest then hightest:=data.highp;
if data.lowp<lowest then lowest:=data.lowp;
if data.volum>hvolum then hvolum:=data.volum;
inc(i);
if i=l then begin l:=l+50; setlength(data,l);end;
end;
finally
closefile(dataf);
end;//end of try...finally
end;// end of if .... then
wmf:=tmetafile.Create;
wmf.Enhanced:=true;
wmf.height:=hightest-lowest+20;
wmf.Width:=4*i+20;
wmfvolum:=tmetafile.Create;
wmfvolum.Enhanced:=true;
wmfvolum.Height:=round(hvolum/1000)+10;
wmfvolum.width:=wmf.Width;
wmfcanvas:=tmetafilecanvas.create(wmf,0);
wmfcanvas.pen.style:=pssolid;
wmfvolumcanvas:=tmetafilecanvas.create(wmfvolum,0);
wmfvolumcanvas.pen.Color:=clred;
try
for j:=0 to i do
begin
if data[j].openp>data[j].closeP then wmfcanvas.pen.Color:=clblue;
if data[j].openp<data[j].closeP then wmfcanvas.pen.Color:=clred;
if data[j].openp=data[j].closeP then wmfcanvas.pen.Color:=clblack;
wmfcanvas.moveto(2+4*j,hightest-data[j].openp+10);
wmfcanvas.lineto(2+4*j+2,hightest-data[j].openp+10);
wmfcanvas.moveto(2+4*j+1,hightest-data[j].lowp+10);
wmfcanvas.lineto(2+4*j+1,hightest-data[j].highp+10);
wmfcanvas.moveto(2+4*j+1,hightest-data[j].closep+10);
wmfcanvas.lineto(2+4*j+3,hightest-data[j].closep+10);//draw kline
//*****
wmfvolumcanvas.moveto(2+4*j+1,round(hvolum/1000)+10);
wmfvolumcanvas.LineTo(2+4*j+1,round(hvolum/1000)+10-round(data[j].volum/1000));//draw volum
end
finally
wmfcanvas.free;
wmfvolumcanvas.free;
end;//end of try..finally
if wmf.Width<paintbox1.Width then
paintbox1.canvas.stretchdraw(rect(1,1,4*i+20,paintbox1.Height),wmf)
else
paintbox1.canvas.stretchdraw(rect(1,1,paintbox1.width,paintbox1.Height),wmf);
if wmfvolum.Width<paintbox2.Width then
paintbox2.canvas.StretchDraw(rect(1,1,wmfvolum.width,paintbox2.height),wmfvolum)
else
paintbox2.canvas.stretchdraw(rect(1,1,paintbox2.width,paintbox2.height),wmfvolum);
end;//end of procedure