input:r1(2);//本週大戶增加比例
input:r2(1);//本週散戶減少比例
input:r3(3);//本月大戶增加比例
input:r4(2);//本月散戶減少比例
var: MA_60(0), day_close(0), day_high(0);
day_close = getField("收盤價", "D");
day_high = getField("最高價", "D");
MA_60 = average(day_close, 60);
condition3 = (close / close[1] -1) > 0.05;
condition4 = close > MA_60 and MA_60 > MA_60[1];
condition5 = close > NthHighest(1, close, 20)*0.97;// or (close/NthHighest(1, close, 20) -1) < 0.05;
if getfielddate("大戶持股比例", "W",param:=400) <> date then
value1 = getfield("大戶持股比例", "W")[1]
else
value1 = getfield("大戶持股比例", "W");
if getfielddate("散戶持股比例", "W",param:=100) <> date then
value2 = getfield("散戶持股比例", "W")[1]
else
value2 = getfield("散戶持股比例", "W");
condition1 = (value1 - value1[1] > r1 or value1 - value1[3] > r3) and (value2[3] - value2 > r4 or value2[1] - value2 > r2);
condition2 = volume > 1000;
if condition1 and condition2
and condition3 and condition4 and condition5
and close > average(close, 5)
and average(close, 5) > average(close, 5)[1]
and volume > 1000
and position = 0 then
begin
if close[1] > 10 and close[1] < 20 then setposition(10);
if close[1] > 20 and close[1] < 30 then setposition(6);
if close[1] > 30 and close[1] < 40 then setposition(5);
if close[1] > 40 and close[1] < 80 then setposition(4);
if close[1] > 90 and close[1] < 120 then setposition(2);
if close[1] > 120 and close[1] < 200 then setposition(1);
end;
condition7 = volume > average(volume, 5) and (close/close[1] - 1) < -0.05;
if position > 0 then
begin
if close < average(GetField("收盤價", "D"), 5) and average(close, 5) < average(close, 5)[1] and condition7 then //可以減碼的部位
begin
setPosition(0);
end;
if close < average(close, 10) then setPosition(0);
end;
3 評論