小幫手您好:
我想找出一年當中最大振幅中的最大回檔,顯示在選股結果的一個欄位中,我只要做數值運算,實際上沒有要篩選任何股票,但是我結果跑不出來,能不能幫我看看是哪裡出了問題呢?
以下是我的code:
settotalbar(500);
DataAlign(1);
//設定日期區間
value1=CurrentDate; //現在日期
value7=getbaroffset(EncodeDate(year(value1),01,02)); //年初K棒位置
value2=lowestbar(getfield("low","D"),value7); //期間最低點位置
value4=extremes(getfield("low","D"),value7,-1,value5,value6);
var:Count(0);
var:temp(0);
var:temp_high_bar(0);
var:temp_high_exbar(0);
var:temp_high(0);
var:highrange(0);
var:temp_highrange(0);
var:i(0);
temp_high_exbar = value2;
For i = 1 to value2 Begin
if getfield("low","D")[i] = lowest(getfield("low","D")[i-3],7) then begin
Count = Count + 1;
temp = getfield("low","D")[i];
temp_high_exbar = temp_high_bar;
temp_high_bar = i;
temp_high = highest(getfield("high","D")[i],temp_high_exbar - i);
temp_highrange = (temp_high-temp)/value5*100;
if temp_highrange > highrange then highrange = temp_highrange;
end;
End;
ret = 1;
outputfield1(highrange);
1 評論