商品為台指期貨(FITXN*1.TF),頻率1分,沒有逐筆洗價。
透過return時間判定開始運作是否會導致highest和lowest抓取錯誤資料??
我設9點5分不中斷(也就是開始),highest和lowest的期數皆為35,發現很剛好的是都是(35+5=40)這兩個腳本都是9點39分後抓的資料(highest和lowest)是都正確的,9點39分前都錯,是否不要用return比較好?要用什麼寫法替代?
一、lowest 9:05~9:39都錯誤,9:39後正確
variable: pastlow(0)
if currenttime > 050000 and currenttime < 090500 then return;
if currenttime >= 090500 and currenttime <= 092159 then value100 = TimeValue(CurrentTime, "M") + 14
else
if currenttime > 092159 then value100 = 35;
pastlow = lowest(low[1], value100);
print(file("c:\print\printbc.log"), date, CurrentTime, low, pastlow)

二、highest 9:05~9:39都錯誤,9:39後正確
variable: pasthigh(0)
if currenttime > 050000 and currenttime < 090500 then return;
if currenttime >= 090500 and currenttime <= 092159 then value100 = TimeValue(CurrentTime, "M") + 14
else
if currenttime > 092159 then value100 = 35;
pasthigh = highest(high[1], value100);
print(file("c:\print\printsc.log"), date, CurrentTime, high, pasthigh)

19 評論