请老师指点一下下面日线周期的策略应该如何编写:
开多条件:
出现一个20日最高价后,在接下来的10天之内出现一个5日最低价,
满足上述两条件后,于下一根K线的开盘价开多;
持仓8天后,不论盈亏平仓退出交易
开空条件
出现一个20日最低价后,在接下来的10天之内出现一个5日最高价,
满足上述两条件后,于下一根K线的开盘价开空;
持仓8天后,不论盈亏平仓退出交易
cond_buy:any(l<ref(llv(l,5),1),10)<>0 and ref(h>ref(hhv(h,20),1),10);
if ref(cond_buy,1) then buy(holding=0,1,limitr,o) ;
if enterbars>=8 then sell(holding>0,0,thisclose);
cond_sell:any(H>ref(hhv(h,5),1),10)<>0 and ref(l<ref(llv(l,20),1),10);
if ref(cond_sell,1) then buyshort(holding=0,1,limitr,o);
if enterbars>=8 then sellshort(holding<0,0,thisclose);