input:grid(20,1,60,10);
variable:level=0;
oo:CALLSTOCK('ic08',VTopen,6,0);
cc:=callstock('ic08',vtclose,1,0);
if time=093100 and cc>oo then
begin
tbuy(1,1,mkt);
level:=level+1;
upprice:=oo+level*grid;
DNPRICE:=oo+(level-1)*grid;
end
if time=093100 and cc<=oo then
begin
tbuyshort(1,1,mkt);
level:=0;
upprice:=oo+level*grid;
DNPRICE:=oo+(level-1)*grid;
end
上多:=tbuyholding(1)>0 and cc>=upprice;
下多:=tbuyholding(1)>0 and dnprice>cc;
t1:=cc>=upprice;
if 上多 then
begin
level:=level+1;
upprice:=oo+level*grid;
DNPRICE:=oo+(level-1)*grid;
end
if 下多 then
begin
PD:tsell(1,tholding,mkt);
KK:tbuyshort(1,1,mkt);
level:=level-1;
upprice:=oo+level*grid;
DNPRICE:=oo+(level-1)*grid;
end
if time=closetime(0) and tbuyholding(1)>0 then
tsell(1,tholding,mkt);
上空:=tsellholding(1)>0 and cc>=upprice;
下空:=tsellholding(1)>0 and cc<DNPRICE;
if 上空 then
begin
PK:tsellshort(1,tholding,mkt);
KD:tbuy(1,1,mkt);
level:=level+1;
upprice:=oo+level*grid;
DNPRICE:=oo+(level-1)*grid;
end
if 下空 then
begin
level:=level-1;
upprice:=oo+level*grid;
DNPRICE:=oo+(level-1)*grid;
end
if time=closetime(0) and tsellholding(1)>0 then
tsellshort(1,tholding,mkt);
debugfile('d:\test后台.txt','tbuyholding(1) = %.2f',tbuyholding(1));
debugfile('d:\test后台.txt','tsellholding(1) = %.2f',tsellholding(1));
debugfile('d:\test后台.txt','cc = %.2f',cc);
debugfile('d:\test后台.txt','upprice = %.2f',upprice);
debugfile('d:\test后台.txt','DNPRICE = %.2f',DNPRICE);
debugfile('d:\test后台.txt','上多 = %.2f',上多);
debugfile('d:\test后台.txt','下多 = %.2f',下多);
debugfile('d:\test后台.txt','上空 = %.2f',上空);
debugfile('d:\test后台.txt','下空 = %.2f',下空);
debugfile('d:\test后台.txt','level = %.2f',level);
金哲老师,请您帮忙看看这个公式哪里有问题?我个人看到是LEVEL一直没变过,是不是全局变量设置有问题?
variable这个是图表全局变量
后台全局变量用globalvariable,每次关闭交易后再启动时重置为初值