VARIABLE: eprice=0,zs=0,ko=0;
aa:tholding,linethick0;
bb:=extgbdata('quanju');
cond := bb<>0 and ko=0;
u:BARSLAST(COND)+1;
hu :hhv(high,u);
lu : llv(low,u);
if cond then ko=close;
if bb>0 then begin
if hu-ko<n*mindiff then begin
zs :=hu-n*mindiff;
end
if hu-low>=n*mindiff then begin
zs := ko+p*mindiff;
end
end
if bb<0 then begin
if ko-lu<n*mindiff then begin
zs:= lu+n*mindiff;
end
if hu-lu>=n*mindiff then begin
zs:= ko-p*mindiff;
end
end
zsline :zs,circledot;
if bb>0 and holding=0 then
begin
buy(1,1,thisclose);
end
if holding>0 and cross(zs,low) then
begin
sell(1,0,market);
end
if bb<0 and holding=0 then buyshort(barpos=datacount-1,1,thisclose+mindiff);
if holding<0 and cross(high,zs) then
begin
sellshort(1,0,market);
end
if islastbar then extgbdataset('quanju',aa);
写法不知哪出问题,没有实现开仓后,标出止损线等功能。
问题正在解决中
类似此种的赋值语句,注意写法
cond := bb<>0 and ko=0;---------ko:=0
先仔细研究研究原作者关于"手动开仓,自动平仓"的每一句,再把自己的条件套进去修改.