以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://www.weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://www.weistock.com/bbs/list.asp?boardid=4) ---- 请问如何实现一下策略需求? (http://www.weistock.com/bbs/dispbbs.asp?boardid=4&id=163424) |
-- 作者:一点2015 -- 发布时间:2018/5/14 15:28:02 -- 请问如何实现一下策略需求? 请问一下,下面的代码如何实现 手中没有仓位时 价格等于20均线,就做多。(不论是上穿,还是下穿) 价格等于70均线 就做空。(不论是向上穿越,还是向下穿越。) |
-- 作者:FireScript -- 发布时间:2018/5/14 15:43:58 -- if holding=0 and c=ma(c,20) then buy(1,1,market); if holding=0 and c=ma(c,70) then buyshort(1,1,market); 不过图表上开多前需要平空,反正也是一样的操作。 |
-- 作者:一点2015 -- 发布时间:2018/5/15 22:05:57 -- if holding<0 and HIGH=dd then SELLSHORT(1,1,LIMITR);//平空 if holding>0 and LOW=kk then sell(1,1,LIMITR);//平多 if holding=0 and HIGH=dd then buy(1,1,LIMITR);//开多 if holding=0 and LOW=kk then buyshort(1,1,LIMITR);//开空 我写成这样,没有开仓信号。 比较菜,检查不出来哪 里有问题。
|
-- 作者:wenarm -- 发布时间:2018/5/16 8:24:47 -- 条件不成立,直接输出你的条件的就知道了。 |