Global variable: hold=drawnull;
cc800988:=holding;//这句放在信号稳定的地方,
MA5:MA(CLOSE,5);
MA10:MA(CLOSE,10);
buycond:= CROSS(MA5,MA10);
sellcond:= CROSS(MA10,MA5);
drawtextex(1,1,800,0,\'虚拟持仓为:\'+numtostr(cc800988,0));//在图表上输入虚拟持仓以便监控
if not(islastbar) or workmode<>1 then exit;//最后周期,工作模式
xiadan800988:=cc800988-hold;
if xiadan800988>0.5 then begin
cang:=min(xiadan800988,abs(hold));
if hold<0 then begin
tsellshort(1,cang,mkt,0,0,\'800988\'),allowrepeat;
debugfile(\'D:\\800988.txt\',numtostr(hold,0)+\' \'+numtostr(cc800988,0)+\' 平空 %.0f\',cang);
end
cang:=xiadan800988+min(hold,0);
if cang>0 then begin
tbuy(1,cang,mkt,0,0,\'800988\'),allowrepeat;
debugfile(\'D:\\800988.txt\',numtostr(hold,0)+\' \'+numtostr(cc800988,0)+\' 开多 %.0f\',cang);
end
end
if xiadan800988<-0.5 then begin
cang:=min(abs(xiadan800988),abs(hold));
if hold>0 then begin
tsell(1,cang,mkt,0,0,\'800988\'),allowrepeat;
debugfile(\'D:\\800988.txt\',numtostr(hold,0)+\' \'+numtostr(cc800988,0)+\' 平多 %.0f\',cang);
end
cang:=abs(xiadan800988)-max(hold,0);
if cang>0 then begin
tbuyshort(1,cang,mkt,0,0,\'800988\'),allowrepeat;
debugfile(\'D:\\800988.txt\',numtostr(hold,0)+\' \'+numtostr(cc800988,0)+\' 开空 %.0f\',cang);
end
end
hold:=cc800988; 怎么在最后定义?不解