以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  策略编写求助区  (http://weistock.com/bbs/list.asp?boardid=11)
----  麻烦老师写个策略  (http://weistock.com/bbs/dispbbs.asp?boardid=11&id=73490)

--  作者:金字塔刀客
--  发布时间:2014/12/24 10:12:50
--  麻烦老师写个策略
思路如下:
当收盘价大约MA10,大于MA60,平空开多仓4手,如果收盘价跌破M10,减仓2手,余下多单跌破MA60全部离场,并且收盘价小于MA10,MA60,开空,
谢谢老师。我写了一串老是反复开仓不知道哪里出问题了

--  作者:pyd
--  发布时间:2014/12/26 11:34:52
--  
ma10:ma(c,10);
ma60:ma(c,60);
jc:cross(ma10,c);
qp:cross(ma60,c);
//平空开多
if c>ma10 and c>ma60 then begin
sellshort(holding<0,holding,market);
buy(holding=0,4,market);
end
//减仓
if jc then sell(holding>0,2,market);
//平多开空
if qp then begin
sell(holding>0,holding,market);
if c<ma10 and c<ma60 and holding=0 then buyshort(1,1,market);
end

--  作者:zyf1199
--  发布时间:2014/12/28 14:54:04
--  
谢谢