symbol1:='p00';
symbol2:='y00';
lots1:=1;
lots2:=1;
c1:="p00$close";
c2:="y00$close";
diff:=c1-c2;
//加主體
var1:=ref(diff,1);
var2:=ref(diff,p1);
var3:=abs(diff-var2);
var4:=abs(diff-var1);
var5:=sum(var4,p1);
var6:=var3/var5;
var7:=var6*p2/100;
var8:=var7*var7;
ls1:dma(diff,var8),noaxis;
ls2:=ma(ls1,30);
bp1:=ls1;
bp2:=ls2;
sp1:=ls2;
sp2:=ls1;
//開(kāi)平倉(cāng)
a1:=cross(bp1,bp2);
b1:=cross(sp1,sp2);
if stricmp(stklabel,symbol1)=0 then
begin
if holding=0 then begin
if a1 then buy(1,lots1,market);
end
if holding=0 then begin
if b1 then buyshort(1,1,market);
end
if holding>0 then begin
if b1 then begin
sell(1,1,market);
buyshort(1,1,market);
end
end
if holding<0 then begin
if a1 then begin
sellshort(1,1,market);
buy(1,1,market);
end
end
end
if stricmp(stklabel,symbol2)=0 then
begin
if holding=0 then begin
if b1 then buy(1,lots2,market);
end
if holding=0 then begin
if a1 then buyshort(1,lots2,market);
end
if holding>0 then begin
if a1 then begin
sell(1,lots2,market);
buyshort(1,lots2,market);
end
end
if holding<0 then begin
if b1 then begin
sellshort(1,lots2,market);
buy(1,lots2,market);
end
end
end
// 這樣寫(xiě)有什么問(wèn)題么? 交易次數(shù)測(cè)試出來(lái)的不一樣,求修改?。。。?/p>
數(shù)據(jù)有沒(méi)有補(bǔ)全??jī)蓚€(gè)品種的測(cè)試數(shù)據(jù)長(zhǎng)度是不是一樣的?有沒(méi)有在測(cè)試時(shí)間段那里,勾選 嚴(yán)格按照日期?
怎么測(cè)評(píng)的?帖一下測(cè)試步驟,不一樣的結(jié)果也貼一下?
數(shù)據(jù)有沒(méi)有補(bǔ)全??jī)蓚€(gè)品種的測(cè)試數(shù)據(jù)長(zhǎng)度是不是一樣的?有沒(méi)有在測(cè)試時(shí)間段那里,勾選 嚴(yán)格按照日期?
怎么測(cè)評(píng)的?帖一下測(cè)試步驟,不一樣的結(jié)果也貼一下?
ok了,謝啦,是數(shù)據(jù)的問(wèn)題。