VARIABLE:bj=0;
if aspect=0 and holding=0 and bj=0 then begin
bj:=1;
buy(1,1,thisclose);
end
if H>=PBUY and C>=MAX(O,PBUY) AND MA1>REF(MA1,1) and holding=0 and bj=0 then begin
bj:=2;
buy(1,1,thisclose);
end
if aspect=1 and holding>0 and bj=1 then begin
sell(1,0,thisclose);
bj:=0;
end
if C<stopprice and holding>0 and bj=2 then begin
sell(1,0,thisclose);
bj:=0;
end
if aspect=1 and holding=0 and bj=0 then begin
bj:=1;
BUYSHORT(1,1,thisclose);
end
if L<=PSELL and C<=MIN(O,PSELL) AND MA1<REF(MA1,1) and bj=0 then begin
bj:=2;
BUYSHORT(1,1,thisclose);
end
if aspect=1 and holding>0 and bj=1 then begin
SELLSHORT(1,0,thisclose);
bj:=0;
end
if C<stopprice and holding>0 and bj=2 then begin
SELLSHORT(1,0,thisclose);
bj:=0;
end
开空同理。
if L<=PSELL and C<=MIN(O,PSELL) AND MA1<REF(MA1,1) and bj=0 then begin
bj:=2;
BUYSHORT(1,1,thisclose);
end
像前面那样加一个holding=0的条件
if aspect=1 and holding>0 and bj=1 then begin
SELLSHORT(1,0,thisclose);
bj:=0;
end
if C<stopprice and holding>0 and bj=2 then begin
SELLSHORT(1,0,thisclose);
bj:=0;
end
这里的两句是holding<0
其他地方没问题
可以公用一个变量
[此贴子已经被作者于2017/3/30 13:10:55编辑过]