-- 作者:FireScript
-- 发布时间:2019/3/19 10:01:43
--
UPPER:ref(hhv(h,20),1);//上轨 LOWER:ref(llv(l,20),1);//下轨 ma60:ma(c,60); kd:UPPER-LOWER;//宽度
tlimit:(time>=131000 and time<=175000) or (time>=11000 and time<=61000);//开仓限制时间
S1:=UPPER+kd*0.5; S2:=UPPER+kd; S3:=UPPER+kd*2; X1:=LOWER-kd*0.5; X2:=LOWER-kd; X3:=LOWER-kd*2;
buycond1:cross(c,UPPER) and c>ma60 and kd<=20*MINDIFF;//开多条件 buy(holding=0 and buycond1 and tlimit,1,market); buycond2:cross(LOWER,c) and c<ma60 and kd<=20*MINDIFF;//开空条件 buyshort(buycond2 and holding=0 and tlimit,1,market);
zs1:=cross(UPPER,c) and holding>0;//多头止损
zy1:=(count(cross(c,s1),ENTERBARS+1)>1 and cross(s1,c)) or (count(cross(c,s2),ENTERBARS+1)>1 and cross(s2,c)) or cross(c,s3);//多头止盈 if zs1 or zy1 then sell(holding>0,holding,market);
zs2:=cross(c,UPPER) and holding<0; zy2:=(count(cross(x1,c),ENTERBARS+1)>1 and cross(c,x1)) or (count(cross(x2,c),ENTERBARS+1)>1 and cross(c,x2)) or cross(x3,c); if zs2 or zy2 then sellshort(holding<0,holding,market);
if time>=175100 or time >=61100 then //强平需要根据你使用的周期调整下这里的time判断的数值。 begin sell(holding>0,holding,market); sellshort(holding<0,holding,market); end
[此贴子已经被作者于2019/3/19 10:02:44编辑过]
|