--
tj1:ref(l,1)>ref(l,3) and ref(l,2)>ref(l,3);
tj2:ref(h,1)<ref(h,3) and ref(h,2)<ref(h,3);
n1:barslast(tj1 and tj2);//上次满足条件到当前的周期数
conkd:c>ref(h,n1+3);//开多条件
conkk:c<ref(l,n1+3);//开空条件
conpd:h>ref(h,n1+3);//平多条件
conpk:l<ref(l,n1+3);//平空条件
if holding>0 and conpd then sell(1,0,LIMITR,c);//平多
if holding<0 and conpk then sellshort(1,0,LIMITR,c);//平空
if holding=0 and conkd then buy(1,0,LIMITR,c);//开多
if holding=0 and conkk then buyshort(1,0,LIMITR,c);//开空