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);
现在表现不是我想要的啊。