我寫了一個12:00以後創新高的當沖腳本,停損停利都設1.5%
跑107.11.26的4919新唐
最晚應該都要在12:25前就進場
但腳本回測卻顯示進場時間為12:40
不知問題出在哪裡?

腳本如下:
---------------------------------------------------------------------------------------------------------------------------------
if barfreq <>"Min" or barinterval<> 5 then raiseruntimeerror("歹勢,本腳本只適用於5分鐘線");
variable:_high(0);
input:_Time(120000); // 指定時間
if _Time <= 090000 then raiseruntimeerror("歹勢,本腳本指定時間不可小於等於09:00:00"); // 防呆
if currentdate <> date then return; // 因為當沖,故日期需與系統日期一致
if time >= 090000 and time < _Time and high > _high then _high = high;
// 09:00以後且未過指定時間,如果high>_high則 _high再重新記錄最高價
if time >= _Time
and high > _high
then ret = 1;
1 評論