以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  求按以下文字编写程序化模型!非常感谢~  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=64445)

--  作者:天之wind
--  发布时间:2014/4/28 11:00:39
--  求按以下文字编写程序化模型!非常感谢~
如果大于20日平均成交量,开多
如果小于20日平均成交量,空开
如果有盈利的情况下,与开仓价相比回撤2%止盈。

--  作者:jinzhe
--  发布时间:2014/4/28 11:12:16
--  

if vol>ma(vol,20) then buy(holding=0,1,market);

if vol<ma(vol,20) then buyshort(holding=0,1,market);

if h-enterprice>0 and  ((hhv(h,enterbars+1)-enterprice)-(h-enterprice))/(hhv(h,enterbars+1)-enterprice)>=0.02 and holding>0 then sell(1,0,market);

if enterprice-l<0 and ((enterprice-llv(l,enterbars+1))-(enterprice-l))/(enterprice-llv(l,enterbars+1))>=0.02 and holding<0 then sellshort(1,0,market);