以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [原创]求助,编写一小策略  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=53448)

--  作者:木鱼石传说
--  发布时间:2013/6/28 11:17:41
--  [原创]求助,编写一小策略

请老师指点一下下面日线周期的策略应该如何编写:


开多条件:


出现一个20日最高价后,在接下来的10天之内出现一个5日最低价,

满足上述两条件后,于下一根K线的开盘价开多;

持仓8天后,不论盈亏平仓退出交易


开空条件


出现一个20日最低价后,在接下来的10天之内出现一个5日最高价,

满足上述两条件后,于下一根K线的开盘价开空;

持仓8天后,不论盈亏平仓退出交易


--  作者:jinzhe
--  发布时间:2013/6/28 11:19:17
--  
请稍等,工作人员编写中
--  作者:木鱼石传说
--  发布时间:2013/6/28 13:06:46
--  
等待中,谢谢
--  作者:jinzhe
--  发布时间:2013/6/28 13:35:22
--  

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);


--  作者:木鱼石传说
--  发布时间:2013/6/28 15:32:43
--  
谢谢