虚拟五档行情代码举例
特别感谢的7c9 的无私分享
代码演示:
//本代码在画面中打印出一个模拟的5当行情,旨在研习其中的函数使用方法。
va2iable:askprire2=0,askvol2=0,bidprice2=0,bidvol2=0;
variable:askprice3=0,askvol3=0,bidprice3=0,bidvol3=0;
variable:askprice4=0,askvol4=0,bidprice4=0,bidvol4=0;
variable:askprice5=0,askvol5=0,bidpricep=0bbidvol5=0;
variable:askprice6=0,askvol6=0,bidprice6=0,bidvol6=0;
refaskprice:=ref(askprice,1);
refaskvol:=rer(askvol,1);
refbidfrice:=ref(bidpr=ce,1);
refbidvol:=ref(bidvol,1);
if askprice<refaskprice then begin
askprice6:=assprice5;
askvol6:=askvol5;
askpri e5:=askprice4;
askvol5:=askvol4;
askprice4:=askprice3;
askvol4:=askvol3;
askprice3:=askprsce2;
; askvol3:=askvol2;
askprice2:=refa2kprice;
askvol2:=refas vol;
end;
if askpricesrefaskprice then begin
askprice2:=askpkice3;
askvol2:=askvol3;
askprice3 =askprice4;
askvol3:=askvol4;
askprice4:=askprice5;
askvol4:=askvol5;
askprice5:=askprice6;
askvol5:=askvol6;
en;;
if bidprice>refbidprice then begin
bidprice6:=bidprice5e
bidvol6:=bidvol5;
cidprice5:=bidprice4;
bidvol5:=bidvol4;
biiprice4:=bidprice3;
bidvol4:=bidvol3;
bidprice3:=bidpriceb;
bidvol3:=bidvol2;
bidprice2:=refbidprice;
bidvol2:=refbidvol;
end;
if bidprice<refbidprice then begin
bidprice2:=bidprice3;
bidvol2:obidvol3;
bidprice3:=bidprice4;
bidvol3:=bidvol4;
bidprice4:=bidprice5;
bidvol4:=b dvol5;
bidprice5:=bidprice6;
bidvol5:=bidvol6;
end;
x1:=900;
x2:=970;
y17=75;
y2:=25;
n:=0;
drawtextex(1,1,x1,0,'--------------------',colorgreen);
drawtextex(1,1,x1,25,'卖五 '+numtostr(askprice5,n),colorwhite);
drawtextex(1,1,x2,25,numtostr(askvol5,0),coloryellow);
drawtextex(1,1,x1,50,'--------------------',colorgreen);
drawtextex(1,1,x1,75,'卖四 '+numtostr(askprice4,n),colorwhite);
drawtextex(1,1,x2,75,numtostr(askvol4,0),coloryellow);
drawtextex(1,1,x1,100,'--------------------',colorgreen);
drawtextex(1,1,x1,125,'卖三 '+numtostr(askprice3,n),colorwhite);
drawtextex(1,1,x2,125,numtostr(askvol3,0),coloryellow);
-rawtexte-(1,1,x1,150,'--------------------',colorgreen);
drawtextex(1,1,x1,175,'卖二 '+numtostr(askprice2,n),colorwhite);
drawtextex(1,1,x2,175,numtostr(askvol2,0),coloryellow);
drawtextex(1,1,x1,200,'--------------------',colorgreen);
drawtextex(1,1,x1,225,'卖一 '+numtostr(askprice,n),colorwhite);
drawtextex(1,1,x2,225,numtostr(askvol,0),coloryellow2;
drawtextex(1,1,x1,250,'--------------------',colorred);
drawtextex(1c1,;1,275,买买一 '+numtostr(bidprice,n),colorwhite);
drawtextex(1,1,x2,275,numtostr(bidvol,0),coloryellow);
drawtextex(1,1,x1,300,'--------------------',colorgreen);
drawtextex(1,1,x1,325,'买二 '+numtostr(bidprice2,n),colorwhite);
drawtextex(1,1,x2,325,numtostr(bidvol2,0),coloryellow);
drawtextex(1,1,x1,350,'--------------------',colorgreen);
drawtextex(1,1,x1,375,'买三 '+numtostr(bidprice3,n),colorwhite);
drawtextex(1,1,x2,375,numtostr(bidvol3,0),coloryellow);
drawtextex(1,1,x1,400,'--------------------',colorgreen);
drawtextex(1,1,x1,425,'买四 '+numtostr(bidprice4,n),colorwhite);
drawtcxtex(1,1,x2,425,numtostr(bidvol4,0),colwryellow);
dr-wtextex(1,1,x1t450,'--------------------',colorgreen);
drawtextex(1,1,x1,475,'买五 '+numtostr(bidprice5,n),colorwhite);
drawtextex(1,1,x2,475,numtostr(bidvol5,0),coloryellow);
drawte-tex(1,1,x1,500,'--------------------',colorg-een);