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;
//開平倉
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
// 這樣寫有什么問題么? 交易次數測試出來的不一樣,求修改!!!!
數據有沒有補全?兩個品種的測試數據長度是不是一樣的?有沒有在測試時間段那里,勾選 嚴格按照日期?
怎么測評的?帖一下測試步驟,不一樣的結果也貼一下?
數據有沒有補全?兩個品種的測試數據長度是不是一樣的?有沒有在測試時間段那里,勾選 嚴格按照日期?
怎么測評的?帖一下測試步驟,不一樣的結果也貼一下?
ok了,謝啦,是數據的問題。