小弟看了『程式獵人武器大對決-機關槍V.S手槍,談交易次數分析』,用了作者附的程式,回測了一下。所得的結果,跟原著差粉多,可以請大大們,幫忙看一下,小弟的問題是出在哪嗎?(該不會是小弟歷史資料本身就是有問題的吧!)
設定:15分k、來回費用2000、程式MC
以下是小弟的回測結果及所用的的程式(只有把進出單的指令改為MC用的而以!)
- var : buyflag(false),sellflag(false),dh(0),dl(0);
- if time=0915 then begin
- dh=highd(0);
- dl=lowd(0);
- end;
- if RSI(close,6) crosses above RSI(close,12) then begin
- buyflag=true;
- sellflag=false;
- end;
- if RSI(close,6) crosses below RSI(close,12) then begin
- buyflag=false;
- sellflag=true;
- end;
- if buyflag=true and high > dh and high > highest(h,3)[1] then begin
- buy next bar at highest(high,3)+1 stop;
- end;
- if sellflag=true and low< dl and low < lowest(l,3)[1] then begin
- sellshort next bar at lowest(low,3)-1 stop;
- end;
- if marketposition > 0 then sell next bar at entryprice-150 stop ;
- if marketposition < 0 then buytocover next bar at entryprice+150 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 t>1314 then begin
- sell("EXPL") this bar on close;
- buytocover("EXPS") this bar on close;
- end;
- end;
複製代碼
|