[問題] 使用multicharts測試指定日期的績效
我想要用multicharts來回測指定某個星期幾的績效
譬如常常有人說周五是台股空軍日
所以我想要回測週一到週五只挑一天
在開盤買進收盤賣出的績效
(ex: 每個禮拜一的時候開盤就買進,收盤就賣出)
我試寫的程式是長這個樣子
Inputs: check_day(1);
var: string1(""),string2(""), day_of_week(0);
day_of_week = DayOfWeek(Date);
if day_of_week = check_day then begin
string1 = "dayBuy => " + NumToStr(day_of_week,0);
string2 = "daySell => " + NumToStr(day_of_week,0);
buy (string1) 1 Contract next bar at market;
sell (string2) 1 Contract next bar at market;
end
但是因為都是在next bar同時做買進賣出的動作
所以根本看不出績效是如何
於是賣出的部分我試著用
sell this bar at close
結果賣出的點位就飛到了四天後
我還試了很多其他的寫法,但是compiler都不給過0rz
想請問版上有沒有人碰過類似的情況
方便指點一下該怎麼處理這個問題比較好?
(或是說MC無法解決這個需求?)
感謝~
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.37.96.133
※ 文章網址: https://www.ptt.cc/bbs/Trading/M.1432479224.A.873.html
推
05/25 11:19, , 1F
05/25 11:19, 1F
謝謝!! 不過我也想看看其他四天是怎樣的情況@@
推
05/25 12:25, , 2F
05/25 12:25, 2F
感謝回答!!
不過我剛試了setexitonclose
結果跟this bar at close結果一樣飛去了三天後...
※ 編輯: genesic (114.37.96.133), 05/25/2015 21:43:43
→
05/25 22:05, , 3F
05/25 22:05, 3F
→
05/25 22:06, , 4F
05/25 22:06, 4F
附上這個能跑出我想要的結果的code
Inputs: check_day(1);
var: string1(""),string2(""), day_of_week(0);
day_of_week = DayOfWeek(Date);
if day_of_week = check_day then begin
string1 = "dayBuy => " + NumToStr(day_of_week,0);
buy (string1) 1 Contract next bar at market;
end;
if day_of_week[1] = check_day then begin
string2 = "daySell => " + NumToStr(day_of_week,0);
sell (string2) 1 Contract this bar on close;
end;
※ 編輯: genesic (114.37.96.133), 05/25/2015 22:07:00
推
05/25 22:56, , 5F
05/25 22:56, 5F
推
05/25 23:00, , 6F
05/25 23:00, 6F
推
05/25 23:06, , 7F
05/25 23:06, 7F
→
05/25 23:07, , 8F
05/25 23:07, 8F
→
05/25 23:08, , 9F
05/25 23:08, 9F
推
05/25 23:13, , 10F
05/25 23:13, 10F
→
05/25 23:33, , 11F
05/25 23:33, 11F
→
05/25 23:34, , 12F
05/25 23:34, 12F
→
05/25 23:34, , 13F
05/25 23:34, 13F
Trading 近期熱門文章
57
160
PTT職涯區 即時熱門文章