以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [原创]出问题了怎么写啊。帮忙看看  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=50087)

--  作者:xian_0_9
--  发布时间:2013/3/22 13:27:06
--  [原创]出问题了怎么写啊。帮忙看看

3个品种比较,9点45开仓,哪个品种的涨幅最高,哪个品种开多。涨幅最低的,开空。

//涨幅公式

最高:=hhv(h,barslast(date<>ref(date,1))+1);
最低:=llv(l,barslast(date<>ref(date,1))+1);
开盘:=VALUEWHEN(DATE<>REF(DATE,1),OPEN);
涨幅:=最高-开盘;

/////模型

VARIABLE: X[3]=0;
X[1]:=STKINDI(\'TA00\',\'跌幅涨幅.涨幅\',0,1,0);
X[2]:=STKINDI(\'SR00\',\'跌幅涨幅.涨幅\',0,1,0);
X[3]:=STKINDI(\'RB00\',\'跌幅涨幅.涨幅\',0,1,0);
ta排名:HOD2(X,3,X[1]),LINETHICK0;
sr排名:HOD2(X,3,X[2]),LINETHICK0;
rb排名:HOD2(X,3,X[3]),LINETHICK0;
jysd:=time>=093000 and time<=144500;
if time=CLOSETIME(0) and holding>0 then sell(1,1,limitr,o);
if time=CLOSETIME(0) and holding<0 then sellshort(1,1,limitr,o);



IF ta排名=1 and holding=0 and jysd and STRCMP( stklabel,\'ta00\' )=0  then buy(1,1,market);
IF ta排名=3 and holding=0 and jysd and STRCMP( stklabel,\'ta00\' )=0  then buyshort(1,1,market);
IF sr排名=1 and holding=0 and jysd and STRCMP( stklabel,\'sr00\' )=0  then buy(1,1,market);
IF sr排名=3 and holding=0 and jysd and STRCMP( stklabel,\'sr00\' )=0  then buyshort(1,1,market);
IF rb排名=1 and holding=0 and jysd and STRCMP( stklabel,\'rb00\' )=0  then buy(1,1,market);
IF rb排名=3 and holding=0 and jysd and STRCMP( stklabel,\'rb00\' )=0  then buyshort(1,1,market);

现在表现不是我想要的啊。
 


--  作者:jinzhe
--  发布时间:2013/3/22 13:42:44
--  
判断涨幅的公式设置成逐k线计算
--  作者:xian_0_9
--  发布时间:2013/3/22 14:25:41
--  
是逐K也没好使:(