我想用以下的條件做選股加上條件的分類但條件多數都會混再一起
譬如選出A股條件符合多方進場但分類還是會有空方出場
究竟是哪一段撰寫錯誤
還有我在condition11~23=false會不會多餘
麻煩各位高手指教
如何修改
謝謝
input:Leng1(5),Leng2(10)
input:Length(20),UpperBand(2),LowerBand(2);
variable: ma1(0), ma2(0);
variable: up(0), mid(0), down(0);
setbarback(maxlist(Leng1,Leng2,Leng3));
settotalbar(maxlist(Leng1,Leng2,Leng3)+10);
ma1 = average(close, Leng1);
ma2 = average(close, Leng2);
up = bollingerband(Close, Length, UpperBand);
down = bollingerband(Close, Length, LowerBand);
mid = (up + down) / 2;
condition1 = volume > 1000;
condition11=false;
condition12=false;
condition13=false;
condition21=false;
condition22=false;
condition23=false;
condition11= close > ma1 and ma1 > ma2; //收在多方
condition12= close < down; //收盤小於下軌
condition13= close > down; //收盤大於下軌
condition21= close < ma1 and ma1 < ma2; //收在空方
condition22= close < up; //收盤小於上軌
condition23= close > up; //收盤大於上軌
if condition11 and condition1 then
begin
if condition12 then ret = 1;
end;
outputfield1(condition12,"多方超賣");
if condition11 and condition1 then
begin
if condition13 then ret = 1;
end;
outputfield2(condition13,"多方進場");
if condition21 and condition1 then
begin
if condition22 then ret = -1;
end;
outputfield3(condition22,"空方超買");
if condition21 and condition1 then
begin
if condition23 then ret = -1;
end;
outputfield4(condition23,"空方出場");
7 評論