测试代码1:
input:xx(13,1,50,1),zz(14,1,50,1);
x:=xx/10;
z:=zz/10;
lc:=ref(c,1);
TR1:=ema(MAX((HIGH-LOW),max(ABS(REF(CLOSE,1)-HIGH),ABS(REF(CLOSE,1)-LOW))),20);
tr2:ref(tr1,1),linethick0;
sell(holding>0 and close<=hhv(high,enterbars)-z*tr2,0 and c<lc ,0,thisclose);
sellshort(holding<0 and close>llv(low,enterbars)+z*tr2 and c>lc ,0,thisclose);
buy(holding=0 and vol>=5000 and close>llv(low,exitbars)+x*tr2 and c>lc ,intpart(asset*0.4/close),thisclose);
buyshort(holding=0 and vol>=5000 and close<=hhv(high,exitbars)-x*tr2 and c<lc ,intpart(asset*0.4/close),thisclose);
资产:ASSET,colorgreen,noaxis;
持仓:Holding,linethick0;
图表交易代码2:
input:xx(13),zz(14);
x:=xx/10;
z:=zz/10;
lc:=ref(c,1);
TR1:=ema(MAX((HIGH-LOW),max(ABS(REF(CLOSE,1)-HIGH),ABS(REF(CLOSE,1)-LOW))),20);
tr2:ref(tr1,1),linethick0;
lc:=ref(c,1);
Exitlong:close<hhv(high,enterbars)-z*tr2 and c<lc,Tfilter ;
Exitshort:close>llv(low,enterbars)+z*tr2 and c>lc ,Tfilter;
Enterlong:close>llv(low,exitbars)+x*tr2 and c>lc ,Tfilter;
Entershort:close<hhv(high,exitbars)-x*tr2 and c<lc ,Tfilter;
资产:Tasset,noaxis;
持仓:Tholding,noaxis;
请教
1:这样的改写是否正确?不正确的话,错在哪里?
2:图表交易空仓是如何显示的?
3:Enter语句不可以模拟测试,在飞狐里是可以的吧?
4:图表交易代码中Tasset 可以读到数据,而Tholding 不可以,bug?
谢谢。
[此贴子已经被作者于2009-12-24 12:44:43编辑过]