hi 小幫手,
想問一個取區間創新高的邏輯問題,
我想用選股找創60日新高的股票,
input: period(60);
(1) if C>highest(h,period)[1] then ret=1; // 選出74檔
(2) if C>highest(h[1],period) then ret=1; // 選出63檔
(3) condition1=C>highest(h,period); if condition[1] then ret=1; // 選出0檔
(1)是錯的,(2)是我要的,(3)選不出來。分不太清楚他們的差異,不知道為什麼他們的結果會不一樣?
另外將(1)改成
value1=highest(h,period);
if C>value1[1] then ret=1; 結果就會跟(2)一樣,會是60日新高選股的結果。


2 評論