以文本方式查看主题

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

--  作者:分享
--  发布时间:2013/7/12 21:38:44
--  老师帮忙篇一个金字塔的程序

一价格在20日线之上,而且满足KDJ J>K 开多仓

二五日线向下的时候就平仓

三价格在20日线之下,而且满足KDJ J<K 开空仓

四五日线向上的时候就平仓

应该怎么篇写呢?


--  作者:jinzhe
--  发布时间:2013/7/15 9:30:10
--  

n:=9;
p1:=3;
p2:=3;

RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:=SMA(RSV,P1,1);
D:=SMA(K,P2,1);
J:=3*K-2*D;

ma1:ma(c,5);
ma2:ma(c,20);

if c>ma2 and j>k then buy(holding=0,1,market);

if ma1<ref(ma1,1) then sell(holding>0,0,market);

if c<ma2 and j<k then buyshort(holding=0,1,market);

if ma1>ref(ma1,1) then sellshort(holding<0,0,market);