選股正常,回測全部失敗

  •   99 
  • 最後發表   布魯克  2019 八月 30
布魯克 發文於   2019/08/26

這是我的程式

input: FastLength(12), SlowLength(26), MACDLength(9), KDLength(9), RSVt(3), Kt(3);

input: Length_W(9, "周KD期間");

variable: difValue(0), macdValue(0), oscValue(0),rsv(0), k(0), _d(0);

variable: rsv_w(0),kk_w(0),dd_w(0);

 

SetTotalBar( maxlist((maxlist(KDLength,6) * 3),((maxlist(FastLength,SlowLength,6) + MACDLength) * 4)));

 

SetInputName(1, "DIF短期期數");

SetInputName(2, "DIF長期期數");

SetInputName(3, "MACD期數");

SetInputName(4, "天數");

SetInputName(5, "RSVt權數");

SetInputName(6, "Kt權數");

 

MACD(weightedclose(), FastLength, SlowLength, MACDLength, difValue, macdValue, oscValue);

Stochastic(KDLength, RSVt, Kt, rsv, k, _d);

xf_stochastic("w", Length_W, 3, 3, rsv_w, kk_w, dd_w);

 

value1=(GetField("外資買賣超") + GetField("投信買賣超")+GetField("自營商買賣超"));

 

condition1 = k crosses over _d and k<30;

condition2 = volume > 300;

condition3 = GetField("成交量")>GetField("成交量")[1]*1.5;

condition4 = GetField("月營收年增率","M") > 0;

condition5 = GetField("每股稅後淨利(元)","Q") > GetField("每股稅後淨利(元)","Q")[4];

condition6 = value1 > 0 ;

 

Ret = condition1 and condition2 and condition3 and condition4 and condition5 and condition6 and difValue<0 and kk_w<50;

 

SetOutputName1("法人買賣超");

OutputField1(value1);

附加文件

XQ小幫手 發文於   2019/08/30

Hi 布魯克

經確認,目前回測限定執行時間為五分鐘。

而您的策略其計算資料內包含了幾個計算量較大的函式(MACD.Stochastic.xf_stochastic)

因此建議您的回測時間應縮短至多8個月左右(例如2018/12/28至2019/08/28)

以上說明,謝謝。

發表回覆
Close