| 關於另一篇的回測結果(程式交易之技術分析策略探討-MACD指標),還是有差距。 
 設定:標的-台指、週期-15分k、時間範圍-2001/1/2~2011/8/31、平台-MC、大大附的程式只修改為mc的進出場指令、來回費用1000。
 小弟的回測結果(程式應該是有1+2濾網):
 
   
 
 原板大的結果:
 
   
 
 小弟用的程式碼:
 
 複製代碼input : FMA(13),SMA(26),MMA(9); 
var : BuyFlag(false),SellFlag(false),Dif(0),xMacd(0),Dem(0); 
Dif=MACD(Close, FMA, SMA); 
Dem=XAverage(MACD(Close, FMA, SMA), MMA); 
xMacd=Dif-Dem; 
if Dif cross over Dem then begin 
        BuyFlag=true; 
        SellFlag=false; 
end; 
if Dif cross under Dem then begin 
        SellFlag=true;        
        BuyFlag=false; 
end;        
if time < iff(condition1,1315,1330) and buyflag=true and xMacd > xMacd[1] and xMacd[1] > xMacd[2] and high > lowd(0)+1.5*average(high-low,3) 
then buy next bar at highest(high,3)+1 stop; 
if time < iff(condition1,1315,1330) and sellflag=true and xMacd < xMacd[1] and xMacd[1] < xMacd[2] and low < highd(0)-1.5*average(high-low,3) 
then sellshort next bar at lowest(low,3)-1 stop; 
if marketposition>0 then sell next bar at entryprice-200 stop; 
if marketposition<0 then buytocover next bar at entryprice+200 stop; 
Condition1=(dayofweek(date)=3 and dayofmonth(date) > 14 and 22 > dayofmonth(date)) 
        or date=1040127 
        or date=1070226 
        or date=1100617 
        or date=1100222; 
        
if condition1=true then begin 
        if time>1314 then begin 
                sell this bar on close; 
                buytocover this bar on close; 
        end; 
end; 
 |