a1:=stickline(barpos=datacount-22,c,o,10,0,COLORMAGENTA);
a2:=stickline(barpos=datacount-10,c,o,10,0,COLORMAGENTA);
a3:=c<a1;
a4:=c>a1;
mm:=ref(h,1)=hhv(h,3);
nn:=ref(l,1)=llv(l,3);
if mm then bj:=1;
if nn then bj:=-1;
nn1:=barslast(mm);
nn2:=barslast(nn);
if c<ref(l,nn1+1) and bj=1 then i:=1;
if c>ref(h,nn2+1) and bj=-1 then i:=-1;
uu3:=cross(i=1,0.5);//绿
uu4:=cross(i=-1,0.5);//红
if a3 and uu3 then begin
buyshort(holding=0,1,market);//阴包阳,卖出
end
if a4 and uu4 then begin
buy(holding=0,1,market);//阳包阴,买入
end
if holding>0 and c>a2 then sellshort(1,0,thisclose);
if holding>0 and c<a2 then sell(1,0,thisclose);
问一下 为什么我这个代码放在交易系统里面不能进行交易?求改正!
stickline出来就是一个图,没有结果,a1和a2的赋值无效
前面第10根和第22根k线的收盘价。a1是前面第22根k线的收盘价,a2是10k的收盘价
a1:=ref(c,22);
a2:=ref(c,10);
a3:=c<a1;
a4:=c>a1;
mm:=ref(h,1)=hhv(h,3);
nn:=ref(l,1)=llv(l,3);
if mm then bj:=1;
if nn then bj:=-1;
nn1:=barslast(mm);
nn2:=barslast(nn);
if c<ref(l,nn1+1) and bj=1 then i:=1;
if c>ref(h,nn2+1) and bj=-1 then i:=-1;
uu3:=cross(i=1,0.5);//绿
uu4:=cross(i=-1,0.5);//红
if a3 and uu3 then begin
buyshort(holding=0,1,market);//阴包阳,卖出
end
if a4 and uu4 then begin
buy(holding=0,1,market);//阳包阴,买入
end
if holding<0 and c>a2 then sellshort(1,0,thisclose);
if holding>0 and c<a2 then sell(1,0,thisclose);
这样的话入场测试还是不对啊 不交易。能不能帮我在检查一下到底哪里出问题
以下是引用曹晓东在2016-11-30 10:51:09的发言:
这样的话入场测试还是不对啊 不交易。能不能帮我在检查一下到底哪里出问题
入场测试还是不对 指的是什么
不交易 指的是不下单?
就这样 测试结果为000

此主题相关图片如下:qq图片20161130110351.png