 
等级: 超级版主
- 注册:
- 2021-5-18
- 曾用名:
- FireScript
|
本帖最后由 技术009 于 2022-11-22 15:42 编辑
input:s1(1,1,100,1),s2(2,1,100,1);
j:=barslast(date<>ref(date,1))+1;
oo:valuewhen(j=1,o);
ha1:=ref(hhv(h,j),j);
la:=ref(llv(l,j),j);
ter:=ha1-la;
aa:oo+0.5*ter;
bb:oo-0.5*ter;
ma5:ma(c,5);
t:=type(1);
b1:=not(t=4 and enterbars+1<j-1) and not(t=2 and enterbars+1<j-1);
if b1 and ref(cross(c,aa),1) and c>aa and ter<c*0.05 and todaybar<120 then buy(holding=0,s1,market);
if b1 and enterbars+1<j and holding>0 and c>enterprice then buy(1,s2,market);
if b1 and enterbars+1<j and holding>0 and c>enterprice then buy(1,s2,market);
if b1 and ref(cross(bb,c),1) and c<bb and ter<c*0.05 and todaybar<120 then buyshort(holding=0,s1,market);
if b1 and enterbars+1<j and holding<0 and c<enterprice then buyshort(1,s2,market);
if b1 and enterbars+1<j and holding<0 and c<enterprice then buyshort(1,s2,market);
if c>bb and c>=(enterprice+enterprice*0.006) and holding=-s1 then sellshort(1,holding,market);
if aa>c and c<=(enterprice-enterprice*0.006) and holding=s1 then sell(1,holding,market);
if c>bb and c>=(enterprice+enterprice*0.004) and holding=-(s1+s2) then sellshort(1,holding,market);
if aa>c and c<=(enterprice-enterprice*0.004) and holding=s1+s2 then sell(1,holding,market);
if c>bb and c>=(enterprice+enterprice*0.002) and holding<-(s1+s2) then sellshort(1,holding,market);
if aa>c and c<=(enterprice-enterprice*0.002) and holding>s1+s2 then sell(1,holding,market);
sklow:=llv(l,enterbars+1);
bkhigh:=hhv(h,enterbars+1);
if sklow<=enterprice*0.99 and c>=enterprice then sellshort(1,holding,market);
if bkhigh>=enterprice*1.01 and c<=enterprice then sell(1,holding,market);
if exist(every(isdown,3),5) and enterprice-c>c*0.01 and cross(c,ma5) then sellshort(1,s1,market);
if exist(every(isup,3),5) and c-enterprice>c*0.01 and cross(ma5,c) then sell(1,s1,market);
if exist(every(isdown,3),5) and enterprice-c>c*0.02 and cross(c,ma5) then sellshort(1,s2,market);
if exist(every(isup,3),5) and c-enterprice>c*0.02 and cross(ma5,c) then sell(1,s2,market);
if exist(every(isdown,3),5) and enterprice-c>c*0.03 and cross(c,ma5) then sellshort(1,s2,market);
if exist(every(isup,3),5) and c-enterprice>c*0.03 and cross(ma5,c) then sell(1,s2,market);
if c>=(enterprice+enterprice*0.01) then sellshort(1,s2,market);
if c<=(enterprice-enterprice*0.01) then sell(1,holding,market);
m1:t0totime(timetot0(closetime(0))-3*60); //收盘前1分钟
if (m1<=dynainfo(207) and islastbar) or (time=190000 and not(islastbar)) then begin //注意:6.23 以后版本,图表上使用islastbar函数,请勿勾选仅刷最后一根k
收盘平多:sell(1,holding,market);
收盘平空:sellshort(1,holding,market);
end
|
|