我的問題 9:10 跳出時 但是兩根K棒的值是 9:00 跟 9:05
參考範例程式改的
variable:KBarOfDay(0);
if Date <> Date[1] then KBarOfDay=1 else KBarOfDay+=1;
if KBarOfDay = 2 then
begin
value1 = bollingerband(Close[2], 20, 2);
value2 = bollingerband(Close[2], 20, -2);
value3 = bollingerband(Close[1], 20, 2);
value4 = bollingerband(Close[1], 20, -2);
value5 = bollingerband(Close, 20, 2);
value6 = bollingerband(Close, 20, -2);
print(file("d:\print\Ten.log"), currenttime, symbol,"0 BB", KBarOfDay, close[2], value1, value2);
print(file("d:\print\Ten.log"), currenttime, symbol,"5 BB", KBarOfDay, close[1], value3, value4);
print(file("d:\print\Ten.log"), currenttime, symbol,"10 BB", KBarOfDay, close, value5, value6);
end;
91001.000000 3533.TW 0 BB 2.000000 228.000000 228.174456 223.575544 => 抓到 昨天
91001.000000 3533.TW 5 BB 2.000000 234.500000 230.721499 221.978501 => 抓到 9:00
91001.000000 3533.TW 10 BB 2.000000 238.500000 233.831593 220.268407 => 抓到 9:10
回測的時候 KBarOfDay = 3 數值才會正常
我的問題
1. 頻率5分鐘 回測的時候 9:00 9:05 9:10 會分別個進來一次 這不符合邏輯 所以KBarOfDay 2 改 3 才正常
2. 實際上跑程式 9:10 有跳出 但是都抓到 上一檔的5分K
3. 是我的程式有問題 還是甚麼地方沒注意到
4. 已經參考範例程式 還是有其他驗證過的範例可以參考
感謝
8 評論