variable:n=0;
if 開倉條件1 and holding=0 then begin
下單語句;
n:=1;
end
if 開倉條件2 and holding=0 then begin
下單語句;
n:=2;
end
if 開倉條件3 and holding=0 then begin
下單語句;
n:=3;
end
if 平倉語句1 and n=1 then 平倉語句;
if 平倉語句2 and n=2 then 平倉語句;
if 平倉語句3 and n=3 then 平倉語句;
variable:n=0;
if 開倉條件1 and holding=0 then begin
下單語句;
n:=1;
end
假定成立,開倉了,持倉量就大于0了
if 開倉條件2 and holding=0 then begin
下單語句;
n:=2;
end
但因為持倉量大于0,不滿足HOLDING=0,所以不會有開倉動作,即不滿足IF的判斷,那N如何得到賦值2?
if 開倉條件3 and holding=0 then begin
下單語句;
n:=3;
end
if 平倉語句1 and n=1 then 平倉語句;
if 平倉語句2 and n=2 then 平倉語句;
if 平倉語句3 and n=3 then 平倉語句;