想請教回測資料為何使用大台和小台進行回測數據會不一樣呢?

  •   96 
  • 最後發表   ken哥  2022 七月 26
ken哥 發文於   2022/07/18

想請教寫了以下交易腳本請問為何大小台測試出來的數據不一樣呢?

 

if barfreq <> "min" or barInterval<>30 then raiseruntimeerror ("本腳本只適用於30分K");

var: stop_point(0), controller(0);

value1 = highest(C[1],20);

value2 = lowest(C[1],20);

input: profit_point(100, "停利(點)");

input: profit_drawback_point(50, "停利回跌(點)");

input: loss_point(100, "停損(點)");

condition1 = c>value1;

condition2 = c<value2;

if profit_point = 0 then raiseruntimeerror("請設定停利(點)");

if profit_drawback_point = 0 then raiseruntimeerror("請設定停利回跌(點)");

if profit_drawback_point > profit_point then raiseruntimeerror("停利(點)需大於停利回跌(點)");

if position = 0 and filled = 0 and condition1 then setposition(1, market);

if position = 0 and filled = 0 and condition2 then setposition(-1, market);

 

if Position = -1 and Filled = -1 then begin

var: intrabarpersist max_profit_point(0);{ 啟動停利後最大獲利點 }

if loss_point > 0 and Close >= FilledAvgPrice + loss_point then begin{ 停損 }

SetPosition(0);

max_profit_point = 0;

end else begin{ 判斷是否要啟動停利 }

if max_profit_point = 0 and Close <= FilledAvgPrice - profit_point then begin

max_profit_point = Close;

end;

if max_profit_point <> 0 then begin

if Close >= max_profit_point + profit_drawback_point then begin{ 停利 }

SetPosition(0);

max_profit_point = 0;

end else if Close < max_profit_point then begin{ 移動最大獲利點 }

max_profit_point = Close;

end;

end;

end;

 

end;

 

if Position = 1 and Filled = 1 then begin

if loss_point > 0 and Close <= FilledAvgPrice - loss_point then begin{ 停損 }

SetPosition(0);

max_profit_point = 0;

end else begin{ 判斷是否要啟動停利 }

if max_profit_point = 0 and Close >= FilledAvgPrice + profit_point then begin

max_profit_point = Close;

end;

 

if max_profit_point <> 0 then begin

if Close <= max_profit_point - profit_drawback_point then begin{ 停利 }

SetPosition(0);

max_profit_point = 0;

end else if Close > max_profit_point then begin{ 移動最大獲利點 }

max_profit_point = Close;

end;

end;

end;

 

end;

 

XQ小幫手 發文於   2022/07/26

Hello ken哥,

 

小幫手這邊參照您的腳本在FITXN*1 和 FIMTXN*1 上作了回測,兩者是相似的,且進出場交易時間大多相同,但會因為價格有些許不同。

至於報酬率的部分則因為兩者1點的獲利虧損金額不同,所以兩者會有差別。

附上截圖、報表以及腳本。

如果您還有問題的話,麻煩您提供 有問題的報表、自動交易腳本匯出檔 以及 XQ Log 來檢驗。

Log資料夾(預設路徑:C:\SysJust\XQLite\LOG)直接壓縮後提供即可。

您可以直接將檔案上傳,如果檔案過大的話也可以Mail至客服信箱 XQservice@XQ.com.tw 且務必附上 討論文章連結網址(小幫手才能盡早處理)。

感謝。

附加文件

發表回覆
Close