又是令人無言的回測

  •   170 
  • 最後發表   帥哥元  2023 四月 18
帥哥元 發文於   2023/04/16

已發mail了

 

寫了一個自動交易做回測

回測半年,感覺回測結果應該還準確

回測一年,資料就亂了

回測十年,資料還是亂的

整個回測就是不準

以下這個指令不至於每天發生吧

 if Close cross Over Value1 then Ret = Value1;

排序方式: 標準 | 最新
XQ小幫手 發文於   2023/04/18

Hello 帥哥元,

 

您的函數腳本應該是有誤。

if Close cross Over Value1 then Ret = Value1 else Ret = 0;

這一段您是寫在 if condition1 and condition2 and condition3 and condition4 and condition5 裡面。

如果 condition1 and condition2 and condition3 and condition4 and condition5 不符合的話,那麼 Ret 就會是之前的值,也就是只要有一次符合後,Ret就會維持在1,除非發生 condition1 ~ condition5 符合然後 close 沒有 cross over value1 這樣 Ret 才會變回0。

 

建議您可以修改為 

if condition1 and condition2 and condition3 and condition4 and condition5 and Close cross Over Value1 then Ret = Value1 else Ret = 0;

把Ret和停損停利分開來另外寫,這樣應該才會是您要的結果。

帥哥元 發文於   2023/04/18

謝謝小幫手,我再試試看

發表回覆
Close