当前的价格低于昨日收盘价且价差小于N的时候开空,当前的价格高于昨日的收盘价且价差小于N的时候开多。 而且一天之中任何情况下只许开一次仓,并再尾盘平仓。应该是这样表述的,请问如何实现呢。 |
variable:aa=0;
nn:=barslast(date<>ref(date,1))+1;
zs:=ref(c,nn);
if aa=0 and zs>c and abs(zs-c)<n then begin
buyshort();
aa:=1;
end
if aa=0 and zs<c and abs(zs-c)<n then begin
buy();
aa:=1;
end
if time>xxxxxx and aa=1 then begin
sell();
sellshort();
aa:=0;
end
仅供参考