VARIABLE:mark:=1;//全局变量 标记止损反手的操作
if 止损条件 then
begin
sell();//止损
buyshort(holding=0 and mark,1,market);//反手,这里用全局变量限制了反手操作
mark:=0;
end
if time=closetime(0) then mark:=1;//收盘后重置回1
如果是日线级别的模型
if time=closetime(0) then mark:=1;//收盘后重置回1
这句代码就去掉就行了。
之前的代码或者可以直接这样做反手的代码这样限制下 也就不用全局变量了。
if count(止损条件,0)=1 and 止损条件 then buyshort(holding=0 and mark,1,market);//反手