以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  请老师帮忙写一个模型  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=73324)

--  作者:csw28
--  发布时间:2014/12/20 0:06:35
--  请老师帮忙写一个模型
1、以沪深300指数为信号,当收盘价在20天线以上时,开当月期指多单;2、当收盘价在20天线以下时,平多单,开当月期指空单。
--  作者:pyd
--  发布时间:2014/12/21 20:52:56
--  
ma20:ma(c,20);
if c>ma20 then begin 
sellshort(holding<0,holding,market);
buy(holding=0,1,market);
end
if c<ma20 then begin 
sell(holding>0,holding,market);
buyshort(holding=0,1,market);
end