以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  我是正版用户,帮忙写一个小策略  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=91848)

--  作者:tanjun
--  发布时间:2016/2/24 17:20:52
--  我是正版用户,帮忙写一个小策略

我是正版软件用户,帮帮忙,谢谢!

 

空头开平仓条件:5周期均线和20周期均线同时向下且k线收盘价收在5周期均线之下,开空,K线收盘价收在5周期均线之上且5周期均线拐头向上,平仓;

多头开平仓条件:5周期均线和20周期均线同时向上且k线收盘价收在5周期均线之上,开多,K线收盘价收在5周期均线之下且5周期均线拐头向下,平仓;
 

任何周期都可以用
--  作者:jinzhe
--  发布时间:2016/2/24 17:25:04
--  

ma5:ma(c,5);
ma20:ma(c,20);

if ma5<ref(ma5,1) and ma20<ref(ma20,1) and c<ma5 then buyshort(holding=0,1,marketr);

if c>ma5 and ma5>ref(ma5,1) and ref(ma5<ref(ma5,1),1) and holding<0 then sellshort(1,0,marketr);


if ma5>ref(ma5,1) and ma20>ref(ma20,1) and c>ma5 then buy(HOLDING=0,1,marketr);

if c<ma5 and ma5<ref(ma5,1) and ref(ma5>ref(ma5,1),1) and holding>0 then sell(1,0,marketr);