if holding>0 and (ek2) then begin
sell(1,holding,limitr,c),ORDERQUEUE;
buyshort(1 and time>091000,ss,limitr,c),ORDERQUEUE;
end
if holding<0 and (ed2) then begin
sellshort(1,holding,limitr,c),ORDERQUEUE;
buy(1 and time>091000,ss,limitr,c),ORDERQUEUE;
end
buy(ed1 and holding=0,ss,limitr,c);
buyshort(ek1 and holding=0,ss,limitr,c);
buy((d4) and holding=0,ss,limitr,c);
buyshort((k4) and holding=0,ss,limitr,c);
是这样: 当d4 k4持仓 遇到ed2 ek2不反手
不清楚楼主的 D4 K4等条件是什么,所以我自己随意的定义了下,测试结果是有反手的
ek2:=cross (ma(c,5),ma(c,10));
ed2:=cross (ma(c,10),ma(c,5));
ss:=10;
ed1:=c>ref(c,1);
ek1:=c<ref(c,1);
d4:=c>o;
k4:=c<h;
if holding>0 and (ek2) then begin
sell(1,holding,limitr,c),ORDERQUEUE;
buyshort(time>091000,ss,limitr,c),ORDERQUEUE;
end
if holding<0 and (ed2) then begin
sellshort(1,holding,limitr,c),ORDERQUEUE;
buy(time>091000,ss,limitr,c),ORDERQUEUE;
end
buy((d4) and holding=0,ss,limitr,c);
buyshort((k4) and holding=0,ss,limitr,c);
反手1:=ed1 and time>091000;
反手2:=ek1 and time>091000;
if holding>0 and (ek2) then begin
sell(1,holding,limitr,c),ORDERQUEUE;
buyshort(反手1,ss,limitr,c),ORDERQUEUE;
end
if holding<0 and (ed2) then begin
sellshort(1,holding,limitr,c),ORDERQUEUE;
buy(反手2,ss,limitr,c),ORDERQUEUE;
end
buy(ed1 and holding=0,ss,limitr,c);
buyshort(ek1 and holding=0,ss,limitr,c);
buy((d4) and holding=0,ss,limitr,c);
buyshort((k4) and holding=0,ss,limitr,c);
是这样: 当d4 k4持仓 遇到ed2 ek2不反手
是这个意思吗?